@@ -10,12 +10,14 @@ def main():
10
10
args = parser .parse_args ()
11
11
12
12
struct = {}
13
- networks = []
13
+ networks = set ()
14
14
for cname in args .cnames :
15
- cfile , networks = generate (cname )
15
+ cfile , c_networks = generate (cname )
16
+
16
17
struct .update (cfile )
18
+ networks .update (c_networks )
17
19
18
- render (struct , args , networks )
20
+ render (struct , args , list ( networks ) )
19
21
20
22
21
23
def render (struct , args , networks ):
@@ -94,12 +96,12 @@ def generate(cname):
94
96
networks [network .attrs ['Name' ]] = {'external' : (not network .attrs ['Internal' ])}
95
97
96
98
# Check for command and add it if present.
97
- if cattrs ['Config' ]['Cmd' ] != None :
98
- values ['command' ] = " " . join ( cattrs ['Config' ]['Cmd' ]),
99
+ if cattrs ['Config' ]['Cmd' ] is not None :
100
+ values ['command' ] = cattrs ['Config' ]['Cmd' ]
99
101
100
102
# Check for exposed/bound ports and add them if needed.
101
103
try :
102
- expose_value = list (cattrs ['Config' ]['ExposedPorts' ].keys ())
104
+ expose_value = list (cattrs ['Config' ]['ExposedPorts' ].keys ())
103
105
ports_value = [cattrs ['HostConfig' ]['PortBindings' ][key ][0 ]['HostIp' ]+ ':' + cattrs ['HostConfig' ]['PortBindings' ][key ][0 ]['HostPort' ]+ ':' + key for key in cattrs ['HostConfig' ]['PortBindings' ]]
104
106
105
107
# If bound ports found, don't use the 'expose' value.
0 commit comments