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
Show 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):
...
@@ -82,7 +82,7 @@ def handle_delivery(message):
def
test_local
():
def
test_local
():
home
=
expanduser
(
"~"
)
home
=
expanduser
(
"~"
)
transformer
=
DockerComposeTransformer
(
home
+
"/
workspace/DRIP/docs/input_tosca_files/MOG/test_tosca2
.yml"
)
transformer
=
DockerComposeTransformer
(
home
+
"/
Downloads/tosca
.yml"
)
vresion
=
'2'
;
vresion
=
'2'
;
compose
=
transformer
.
getnerate_compose
(
vresion
)
compose
=
transformer
.
getnerate_compose
(
vresion
)
print
yaml
.
dump
(
compose
)
print
yaml
.
dump
(
compose
)
...
...
drip_parser/src/transformer/docker_compose_transformer.py
View file @
dabe6983
...
@@ -169,9 +169,13 @@ class DockerComposeTransformer:
...
@@ -169,9 +169,13 @@ class DockerComposeTransformer:
for
req
in
requirements
:
for
req
in
requirements
:
if
'volume'
in
req
:
if
'volume'
in
req
:
vol
=
{}
vol
=
{}
if
isinstance
(
req
,
dict
):
name
=
req
[
'volume'
][
'name'
]
name
=
req
[
'volume'
][
'name'
]
path
=
req
[
'volume'
][
'link'
]
path
=
req
[
'volume'
][
'link'
]
vol
[
name
]
=
path
vol
[
name
]
=
path
else
:
vol
=
None
return
None
volumes
.
append
(
vol
)
volumes
.
append
(
vol
)
return
volumes
return
volumes
...
@@ -180,8 +184,8 @@ class DockerComposeTransformer:
...
@@ -180,8 +184,8 @@ class DockerComposeTransformer:
networks
=
[]
networks
=
[]
for
req
in
requirements
:
for
req
in
requirements
:
if
'networks'
in
req
:
if
'networks'
in
req
:
network
=
{}
for
net_name
in
requirements
[
req
]:
networks
.
append
(
requirements
[
req
]
)
networks
.
append
(
net_name
)
return
networks
return
networks
def
analyze_yaml
(
self
,
version
):
def
analyze_yaml
(
self
,
version
):
...
@@ -231,7 +235,10 @@ class DockerComposeTransformer:
...
@@ -231,7 +235,10 @@ class DockerComposeTransformer:
service
[
'networks'
]
=
networks
service
[
'networks'
]
=
networks
for
network
in
networks
:
for
network
in
networks
:
network_id
=
{}
network_id
=
{}
if
isinstance
(
network
,
dict
):
network_id
[
next
(
iter
(
network
))]
=
None
network_id
[
next
(
iter
(
network
))]
=
None
elif
isinstance
(
network
,
str
):
network_id
[
network
]
=
None
all_networks
.
append
(
network_id
)
all_networks
.
append
(
network_id
)
services
[
'services'
][
node_template_key
]
=
service
services
[
'services'
][
node_template_key
]
=
service
...
...
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