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
dabe6983
Commit
dabe6983
authored
Feb 03, 2018
by
Spiros Koulouzis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bug: check if volumes is there or a dict
parent
cd4d6930
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
10 deletions
+17
-10
rpc_server.py
drip_parser/src/rpc_server.py
+1
-1
docker_compose_transformer.py
drip_parser/src/transformer/docker_compose_transformer.py
+16
-9
docker_compose_transformer.pyc
drip_parser/src/transformer/docker_compose_transformer.pyc
+0
-0
No files found.
drip_parser/src/rpc_server.py
View file @
dabe6983
...
...
@@ -82,7 +82,7 @@ def handle_delivery(message):
def
test_local
():
home
=
expanduser
(
"~"
)
transformer
=
DockerComposeTransformer
(
home
+
"/
workspace/DRIP/docs/input_tosca_files/MOG/test_tosca2
.yml"
)
transformer
=
DockerComposeTransformer
(
home
+
"/
Downloads/tosca
.yml"
)
vresion
=
'2'
;
compose
=
transformer
.
getnerate_compose
(
vresion
)
print
yaml
.
dump
(
compose
)
...
...
drip_parser/src/transformer/docker_compose_transformer.py
View file @
dabe6983
...
...
@@ -169,9 +169,13 @@ class DockerComposeTransformer:
for
req
in
requirements
:
if
'volume'
in
req
:
vol
=
{}
name
=
req
[
'volume'
][
'name'
]
path
=
req
[
'volume'
][
'link'
]
vol
[
name
]
=
path
if
isinstance
(
req
,
dict
):
name
=
req
[
'volume'
][
'name'
]
path
=
req
[
'volume'
][
'link'
]
vol
[
name
]
=
path
else
:
vol
=
None
return
None
volumes
.
append
(
vol
)
return
volumes
...
...
@@ -180,8 +184,8 @@ class DockerComposeTransformer:
networks
=
[]
for
req
in
requirements
:
if
'networks'
in
req
:
network
=
{}
networks
.
append
(
requirements
[
req
]
)
for
net_name
in
requirements
[
req
]:
networks
.
append
(
net_name
)
return
networks
def
analyze_yaml
(
self
,
version
):
...
...
@@ -229,10 +233,13 @@ class DockerComposeTransformer:
networks
=
self
.
get_networks
(
requirements
)
if
networks
:
service
[
'networks'
]
=
networks
for
network
in
networks
:
network_id
=
{}
network_id
[
next
(
iter
(
network
))]
=
None
all_networks
.
append
(
network_id
)
for
network
in
networks
:
network_id
=
{}
if
isinstance
(
network
,
dict
):
network_id
[
next
(
iter
(
network
))]
=
None
elif
isinstance
(
network
,
str
):
network_id
[
network
]
=
None
all_networks
.
append
(
network_id
)
services
[
'services'
][
node_template_key
]
=
service
break
...
...
drip_parser/src/transformer/docker_compose_transformer.pyc
View file @
dabe6983
No preview for this file type
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