Permalink
Browse files

Fix restarting gzipped images.

Since the files will have been unzipped in a previous start attempt,
they will fail on a second attempt unless we check that they've already
been unzipped.
  • Loading branch information...
oldpatricka committed Dec 8, 2010
1 parent 7b64f30 commit b94dbc0cbeb4b07439315e8198a8fc3120f8f4c2
Showing with 10 additions and 10 deletions.
  1. +10 −10 control/src/python/workspacecontrol/defaults/imageprocurement/propagate_common.py
@@ -618,24 +618,24 @@ def _one_imagestr(self, logstr, imgstr, unprop=False):
securedir_try = self._derive_instance_dir()
securedir_try = os.path.join(securedir_try, original)
+
+ # We need to check that the image hasn't previously been unzipped
+ gz_parts = original.rsplit(".gz",1)
+ securedir_lessgz_try = self._derive_instance_dir()
+ securedir_lessgz_try = os.path.join(securedir_lessgz_try, gz_parts[0])
localdir_try = os.path.join(self.localdir, original)
# important: try securedir first, it takes precedence
if os.path.exists(securedir_try):
- localdir_try = None
- elif os.path.exists(localdir_try):
- securedir_try = None
- else:
- raise InvalidInput("File specified by relative path ('%s' could resolve to either '%s' or '%s') but it does not exist" % (original, securedir_try, localdir_try))
-
- if securedir_try:
lf.path = securedir_try
- elif localdir_try:
+ elif os.path.exists(securedir_lessgz_try):
+ lf.path = securedir_lessgz_try
+ elif os.path.exists(localdir_try):
lf.path = localdir_try
else:
- raise ProgrammingError("must be relative to either securedir or localdir or it is invalid")
-
+ raise InvalidInput("File specified by relative path ('%s' could resolve to either '%s', '%s', or '%s') but it does not exist" % (original, securedir_try, securedir_lessgz_try, localdir_try))
+
# ---------------------------------------------------------------
elif imgstr[:14] == "blankcreate://":

1 comment on commit b94dbc0

@oldpatricka

This comment has been minimized.

Show comment Hide comment
@oldpatricka

oldpatricka Dec 8, 2010

Member

Huh. This diff looks strange, but it's a pretty simple patch.

Member

oldpatricka commented on b94dbc0 Dec 8, 2010

Huh. This diff looks strange, but it's a pretty simple patch.

Please sign in to comment.