Change naming of key arguments in runner
Change kwargs names in inspect to not collide with python build-in functions Change-Id: I28e27aef9bf0a72fc6b954db40db333c93a15fbd
This commit is contained in:
parent
d3c83259bf
commit
20d6333916
|
@ -203,7 +203,9 @@ class BaseBuilder(object):
|
|||
for image in sorted(images):
|
||||
|
||||
# only pull if the image does not exist locally
|
||||
if self.runner.inspect(image, format='exists', type='image'):
|
||||
if self.runner.inspect(image,
|
||||
output_format='exists',
|
||||
o_type='image'):
|
||||
continue
|
||||
|
||||
try:
|
||||
|
|
|
@ -73,17 +73,17 @@ class BaseRunner(object):
|
|||
|
||||
return [c for c in cmd_stdout.split()]
|
||||
|
||||
def inspect(self, name, format=None, type='container'):
|
||||
cmd = [self.cont_cmd, 'inspect', '--type', type]
|
||||
if format:
|
||||
def inspect(self, name, output_format=None, o_type='container'):
|
||||
cmd = [self.cont_cmd, 'inspect', '--type', o_type]
|
||||
if output_format:
|
||||
cmd.append('--format')
|
||||
cmd.append(format)
|
||||
cmd.append(output_format)
|
||||
cmd.append(name)
|
||||
(cmd_stdout, cmd_stderr, returncode) = self.execute(cmd, self.log)
|
||||
if returncode != 0:
|
||||
return
|
||||
try:
|
||||
if format:
|
||||
if output_format:
|
||||
return cmd_stdout
|
||||
else:
|
||||
return json.loads(cmd_stdout)[0]
|
||||
|
@ -93,7 +93,7 @@ class BaseRunner(object):
|
|||
|
||||
def unique_container_name(self, container):
|
||||
container_name = container
|
||||
while self.inspect(container_name, format='exists'):
|
||||
while self.inspect(container_name, output_format='exists'):
|
||||
suffix = ''.join(random.choice(
|
||||
string.ascii_lowercase + string.digits) for i in range(8))
|
||||
container_name = '%s-%s' % (container, suffix)
|
||||
|
|
|
@ -90,7 +90,7 @@ class TestBaseRunner(base.TestCase):
|
|||
|
||||
self.assertEqual(
|
||||
"bar",
|
||||
self.runner.inspect('one', format='{{foo}}')
|
||||
self.runner.inspect('one', output_format='{{foo}}')
|
||||
)
|
||||
self.assert_execute(
|
||||
popen, ['docker', 'inspect', '--type', 'container',
|
||||
|
|
Loading…
Reference in New Issue