@@ -165,11 +165,11 @@ def convert_volume_binds(binds):
165
165
result = []
166
166
for k , v in binds .items ():
167
167
if isinstance (v , dict ):
168
- result .append ('%s:%s:%s' % (
168
+ result .append ('{0}:{1}:{2}' . format (
169
169
k , v ['bind' ], 'ro' if v .get ('ro' , False ) else 'rw'
170
170
))
171
171
else :
172
- result .append ('%s:%s :rw' % (k , v ))
172
+ result .append ('{0}:{1} :rw' . format (k , v ))
173
173
return result
174
174
175
175
@@ -203,7 +203,8 @@ def parse_host(addr):
203
203
addr = addr .replace ('http+unix://' , 'unix://' )
204
204
205
205
if addr == 'tcp://' :
206
- raise errors .DockerException ("Invalid bind address format: %s" % addr )
206
+ raise errors .DockerException (
207
+ "Invalid bind address format: {0}" .format (addr ))
207
208
elif addr .startswith ('unix://' ):
208
209
addr = addr [7 :]
209
210
elif addr .startswith ('tcp://' ):
@@ -217,15 +218,15 @@ def parse_host(addr):
217
218
else :
218
219
if "://" in addr :
219
220
raise errors .DockerException (
220
- "Invalid bind address protocol: %s" % addr
221
+ "Invalid bind address protocol: {0}" . format ( addr )
221
222
)
222
223
proto = "http"
223
224
224
225
if proto != "http+unix" and ":" in addr :
225
226
host_parts = addr .split (':' )
226
227
if len (host_parts ) != 2 :
227
228
raise errors .DockerException (
228
- "Invalid bind address format: %s" % addr
229
+ "Invalid bind address format: {0}" . format ( addr )
229
230
)
230
231
if host_parts [0 ]:
231
232
host = host_parts [0 ]
@@ -238,13 +239,14 @@ def parse_host(addr):
238
239
)
239
240
240
241
elif proto in ("http" , "https" ) and ':' not in addr :
241
- raise errors .DockerException ("Bind address needs a port: %s" % addr )
242
+ raise errors .DockerException (
243
+ "Bind address needs a port: {0}" .format (addr ))
242
244
else :
243
245
host = addr
244
246
245
247
if proto == "http+unix" :
246
- return "%s ://%s" % (proto , host )
247
- return "%s ://%s:%d" % (proto , host , port )
248
+ return "{0} ://{1}" . format (proto , host )
249
+ return "{0} ://{1}:{2}" . format (proto , host , port )
248
250
249
251
250
252
def parse_devices (devices ):
0 commit comments