Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CONF
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UvA
CONF
Commits
d82f0566
Commit
d82f0566
authored
May 28, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed python build 'error: invalid command 'bdist_wheel'
parent
f8ea03fc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
0 deletions
+86
-0
build.sh
bin/build.sh
+3
-0
__init__.py
deployer/build/lib/test/__init__.py
+0
-0
test_deployer.py
deployer/build/lib/test/test_deployer.py
+83
-0
No files found.
bin/build.sh
View file @
d82f0566
...
...
@@ -16,7 +16,10 @@ do
cd
$python_project
rm
-rf
venv
python3
-m
venv venv
venv/bin/pip3
install
pip
--upgrade
venv/bin/pip3
install
setuptools
--upgrade
venv/bin/pip3
install
-r
requirements.txt
if
[
"
$python_project
"
==
"deployer"
]
;
then
cd
../semaphore-python-client-generated
../
$python_project
/venv/bin/python setup.py
install
...
...
deployer/build/lib/test/__init__.py
0 → 100644
View file @
d82f0566
deployer/build/lib/test/test_deployer.py
0 → 100644
View file @
d82f0566
import
copy
import
json
import
logging
import
os
import
os.path
import
tempfile
import
time
import
yaml
import
re
# noqa: F401
from
pathlib
import
Path
import
unittest
import
sure_tosca_client
from
sure_tosca_client
import
Configuration
,
ApiClient
from
sure_tosca_client.api
import
default_api
from
service.deploy_service
import
DeployService
from
service.tosca_helper
import
ToscaHelper
class
TestDeployer
(
unittest
.
TestCase
):
def
test
(
self
):
logger
=
logging
.
getLogger
(
__name__
)
message_file_path
=
str
(
Path
.
home
())
+
'/Downloads/message_deploy_request.json'
if
os
.
path
.
isfile
(
message_file_path
):
with
open
(
message_file_path
,
'r'
)
as
stream
:
parsed_json_message
=
json
.
load
(
stream
)
# owner = parsed_json_message['owner']
tosca_file_name
=
'tosca_template'
tosca_template_dict
=
parsed_json_message
[
'toscaTemplate'
]
tmp_path
=
tempfile
.
mkdtemp
()
tosca_template_path
=
tmp_path
+
os
.
path
.
sep
+
'toscaTemplate.yml'
with
open
(
tosca_template_path
,
'w'
)
as
outfile
:
yaml
.
dump
(
tosca_template_dict
,
outfile
,
default_flow_style
=
False
)
sure_tosca_base_url
=
'http://localhost:8081/tosca-sure/1.0.0'
polemarch_base_url
=
'http://localhost:30001/api/v2'
semaphore_base_url
=
'http://localhost:3000/api'
tosca_service_is_up
=
ToscaHelper
.
service_is_up
(
sure_tosca_base_url
)
semaphore_is_up
=
ToscaHelper
.
service_is_up
(
semaphore_base_url
)
if
tosca_service_is_up
and
semaphore_is_up
:
tosca_helper
=
ToscaHelper
(
sure_tosca_base_url
,
tosca_template_path
)
self
.
assertIsNotNone
(
tosca_helper
.
doc_id
)
nodes_to_deploy
=
tosca_helper
.
get_application_nodes
()
self
.
assertIsNotNone
(
nodes_to_deploy
)
nodes_pairs
=
tosca_helper
.
get_deployment_node_pairs
()
self
.
assertIsNotNone
(
nodes_pairs
)
username
=
'admin'
deployService
=
DeployService
(
polemarch_base_url
=
polemarch_base_url
,
polemarch_username
=
username
,
polemarch_password
=
'admin'
,
semaphore_base_url
=
semaphore_base_url
,
semaphore_username
=
username
,
semaphore_password
=
'password'
)
for
node_pair
in
nodes_pairs
:
deployService
.
deploy
(
node_pair
)
def
get_tosca_file
(
self
,
file_name
):
tosca_path
=
"../../TOSCA/"
input_tosca_file_path
=
tosca_path
+
'/'
+
file_name
if
not
os
.
path
.
exists
(
input_tosca_file_path
):
tosca_path
=
"../TOSCA/"
input_tosca_file_path
=
tosca_path
+
'/'
+
file_name
dir_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
self
.
assertEqual
(
True
,
os
.
path
.
exists
(
input_tosca_file_path
),
'Starting from: '
+
dir_path
+
' Input TOSCA file: '
+
input_tosca_file_path
+
' not found'
)
return
input_tosca_file_path
if
__name__
==
'__main__'
:
import
unittest
unittest
.
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment