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
9e578a77
Commit
9e578a77
authored
Jun 25, 2020
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug with ports
parent
1c0afedc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
1 deletion
+14
-1
__main__.py
deployer/__main__.py
+2
-0
deploy_service.py
deployer/service/deploy_service.py
+10
-1
tosca_helper.py
deployer/service/tosca_helper.py
+2
-0
No files found.
deployer/__main__.py
View file @
9e578a77
...
...
@@ -91,6 +91,8 @@ def handle_delivery(message):
try
:
for
node_pair
in
nodes_pairs
:
updated_node
=
deployService
.
deploy
(
node_pair
)
if
not
updated_node
:
print
(
updated_node
)
if
isinstance
(
updated_node
,
list
):
for
node
in
updated_node
:
tosca_template_dict
=
tosca_helper
.
set_node
(
node
,
tosca_template_dict
)
...
...
deployer/service/deploy_service.py
View file @
9e578a77
...
...
@@ -32,6 +32,8 @@ class DeployService:
def
deploy
(
self
,
nodes_pair
):
target
=
nodes_pair
[
0
]
source
=
nodes_pair
[
1
]
if
source
.
name
==
'mongo'
:
print
(
source
)
interface_types
=
tosca_helper
.
get_interface_types
(
source
)
if
interface_types
:
ansible_service
=
AnsibleService
(
self
.
semaphore_base_url
,
self
.
semaphore_username
,
self
.
semaphore_password
)
...
...
@@ -42,7 +44,10 @@ class DeployService:
if
'Kubernetes'
in
interface_types
:
task_outputs
=
ansible_service
.
execute
(
nodes_pair
,
'Kubernetes'
,
self
.
vms
,
env_vars
=
env_vars
)
source
=
self
.
set_attributes
(
task_outputs
,
source
)
if
not
source
:
print
(
source
)
if
not
source
:
print
(
source
)
return
source
def
get_env_vars
(
self
,
nodes_pair
):
...
...
@@ -59,6 +64,8 @@ class DeployService:
def
set_attributes
(
self
,
task_outputs
,
source
):
# target = nodes_pair[0]
# source = nodes_pair[1]
if
not
source
:
print
(
source
)
if
source
.
node_template
.
type
==
'tosca.nodes.QC.docker.Orchestrator.Kubernetes'
:
source
=
self
.
set_kubernetes_attributes
(
source
=
source
,
task_outputs
=
task_outputs
)
if
source
.
node_template
.
type
==
'tosca.nodes.QC.Container.Application.Docker'
:
...
...
@@ -66,6 +73,8 @@ class DeployService:
# lst = list(nodes_pair)
# lst[1] = source
# nodes_pair = tuple(lst)
if
not
source
:
print
(
source
)
return
source
...
...
deployer/service/tosca_helper.py
View file @
9e578a77
...
...
@@ -76,6 +76,8 @@ class ToscaHelper:
def
set_node
(
self
,
updated_node
,
tosca_template_dict
):
node_templates
=
tosca_template_dict
[
'topology_template'
][
'node_templates'
]
for
node_name
in
node_templates
:
if
not
hasattr
(
updated_node
,
'name'
):
print
(
updated_node
)
if
node_name
==
updated_node
.
name
:
node_templates
[
node_name
]
=
updated_node
.
node_template
.
to_dict
()
return
tosca_template_dict
...
...
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