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
7 years ago
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):
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
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
=
{}
name
=
req
[
'volume'
][
'name'
]
if
isinstance
(
req
,
dict
):
path
=
req
[
'volume'
][
'link'
]
name
=
req
[
'volume'
][
'name'
]
vol
[
name
]
=
path
path
=
req
[
'volume'
][
'link'
]
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
):
...
@@ -229,10 +233,13 @@ class DockerComposeTransformer:
...
@@ -229,10 +233,13 @@ class DockerComposeTransformer:
networks
=
self
.
get_networks
(
requirements
)
networks
=
self
.
get_networks
(
requirements
)
if
networks
:
if
networks
:
service
[
'networks'
]
=
networks
service
[
'networks'
]
=
networks
for
network
in
networks
:
for
network
in
networks
:
network_id
=
{}
network_id
=
{}
network_id
[
next
(
iter
(
network
))]
=
None
if
isinstance
(
network
,
dict
):
all_networks
.
append
(
network_id
)
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
services
[
'services'
][
node_template_key
]
=
service
break
break
...
...
This diff is collapsed.
Click to expand it.
drip_parser/src/transformer/docker_compose_transformer.pyc
View file @
dabe6983
No preview for this file type
This diff is collapsed.
Click to expand it.
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