docker-puppet.py: don't pull if image exists
This updates the pull function here so that it matches how paunch also handle's images, only pulling them if the existing image doesn't already exist on the host. Change-Id: I90ea41ccdfdb0b9206a63901554d002a5ec0fd3a
This commit is contained in:
parent
b615b3bb93
commit
a28892df4f
@ -59,9 +59,19 @@ def short_hostname():
|
|||||||
|
|
||||||
|
|
||||||
def pull_image(name):
|
def pull_image(name):
|
||||||
log.info('Pulling image: %s' % name)
|
|
||||||
|
subproc = subprocess.Popen(['/usr/bin/docker', 'inspect', name],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE)
|
||||||
|
cmd_stdout, cmd_stderr = subproc.communicate()
|
||||||
|
retval = subproc.returncode
|
||||||
|
if retval == 0:
|
||||||
|
log.info('Image already exists: %s' % name)
|
||||||
|
return
|
||||||
|
|
||||||
retval = -1
|
retval = -1
|
||||||
count = 0
|
count = 0
|
||||||
|
log.info('Pulling image: %s' % name)
|
||||||
while retval != 0:
|
while retval != 0:
|
||||||
count += 1
|
count += 1
|
||||||
subproc = subprocess.Popen(['/usr/bin/docker', 'pull', name],
|
subproc = subprocess.Popen(['/usr/bin/docker', 'pull', name],
|
||||||
|
Loading…
Reference in New Issue
Block a user