projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
10932: Changed _file_paths from being a list to a set so we're not going to copy...
[arvados.git]
/
sdk
/
python
/
arvados
/
commands
/
keepdocker.py
diff --git
a/sdk/python/arvados/commands/keepdocker.py
b/sdk/python/arvados/commands/keepdocker.py
index e8ce2ee21d6299dfb9cf4082d105b2d9a439757f..3a0b64c38f4f543d5b52c8f96f4b38b03a4d741a 100644
(file)
--- a/
sdk/python/arvados/commands/keepdocker.py
+++ b/
sdk/python/arvados/commands/keepdocker.py
@@
-21,6
+21,8
@@
import arvados.commands._util as arv_cmd
import arvados.commands.put as arv_put
import ciso8601
import arvados.commands.put as arv_put
import ciso8601
+from arvados._version import __version__
+
EARLIEST_DATETIME = datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0)
STAT_CACHE_ERRORS = (IOError, OSError, ValueError)
EARLIEST_DATETIME = datetime.datetime(datetime.MINYEAR, 1, 1, 0, 0, 0)
STAT_CACHE_ERRORS = (IOError, OSError, ValueError)
@@
-28,6
+30,9
@@
DockerImage = collections.namedtuple(
'DockerImage', ['repo', 'tag', 'hash', 'created', 'vsize'])
keepdocker_parser = argparse.ArgumentParser(add_help=False)
'DockerImage', ['repo', 'tag', 'hash', 'created', 'vsize'])
keepdocker_parser = argparse.ArgumentParser(add_help=False)
+keepdocker_parser.add_argument(
+ '--version', action='version', version="%s %s" % (sys.argv[0], __version__),
+ help='Print version and exit.')
keepdocker_parser.add_argument(
'-f', '--force', action='store_true', default=False,
help="Re-upload the image even if it already exists on the server")
keepdocker_parser.add_argument(
'-f', '--force', action='store_true', default=False,
help="Re-upload the image even if it already exists on the server")
@@
-399,7
+404,12
@@
def main(arguments=None, stdout=sys.stdout):
# Read the image metadata and make Arvados links from it.
image_file.seek(0)
image_tar = tarfile.open(fileobj=image_file)
# Read the image metadata and make Arvados links from it.
image_file.seek(0)
image_tar = tarfile.open(fileobj=image_file)
- json_file = image_tar.extractfile(image_tar.getmember(image_hash + '/json'))
+ image_hash_type, _, raw_image_hash = image_hash.rpartition(':')
+ if image_hash_type:
+ json_filename = raw_image_hash + '.json'
+ else:
+ json_filename = raw_image_hash + '/json'
+ json_file = image_tar.extractfile(image_tar.getmember(json_filename))
image_metadata = json.load(json_file)
json_file.close()
image_tar.close()
image_metadata = json.load(json_file)
json_file.close()
image_tar.close()