projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' into 11823-collection-lifecycle-doc
[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 5f29bf054b378b09f66889f13c75002b5847525f..22ea4760c94cfb421014085b4ad453bab0be8d0a 100644
(file)
--- a/
sdk/python/arvados/commands/keepdocker.py
+++ b/
sdk/python/arvados/commands/keepdocker.py
@@
-1,5
+1,4
@@
-#!/usr/bin/env python
-
+from builtins import next
import argparse
import collections
import datetime
import argparse
import collections
import datetime
@@
-98,7
+97,7
@@
def docker_image_format(image_hash):
cmd = popen_docker(['inspect', '--format={{.Id}}', image_hash],
stdout=subprocess.PIPE)
try:
cmd = popen_docker(['inspect', '--format={{.Id}}', image_hash],
stdout=subprocess.PIPE)
try:
- image_id = next(cmd.stdout).strip()
+ image_id = next(cmd.stdout).
decode().
strip()
if image_id.startswith('sha256:'):
return 'v2'
elif ':' not in image_id:
if image_id.startswith('sha256:'):
return 'v2'
elif ':' not in image_id:
@@
-111,8
+110,8
@@
def docker_image_format(image_hash):
def docker_image_compatible(api, image_hash):
supported = api._rootDesc.get('dockerImageFormats', [])
if not supported:
def docker_image_compatible(api, image_hash):
supported = api._rootDesc.get('dockerImageFormats', [])
if not supported:
- logger.warn
("server does not specify supported image formats (see docker_image_formats in server config). Continuing
.")
- return
Tru
e
+ logger.warn
ing("server does not specify supported image formats (see docker_image_formats in server config)
.")
+ return
Fals
e
fmt = docker_image_format(image_hash)
if fmt in supported:
fmt = docker_image_format(image_hash)
if fmt in supported:
@@
-315,7
+314,7
@@
def list_images_in_arv(api_client, num_retries, image_name=None, image_tag=None)
# and add image listings for them, retaining the API server preference
# sorting.
images_start_size = len(images)
# and add image listings for them, retaining the API server preference
# sorting.
images_start_size = len(images)
- for collection_uuid, link in hash_link_map.ite
rite
ms():
+ for collection_uuid, link in hash_link_map.items():
if not seen_image_names[collection_uuid]:
images.append(_new_image_listing(link, link['name']))
if len(images) > images_start_size:
if not seen_image_names[collection_uuid]:
images.append(_new_image_listing(link, link['name']))
if len(images) > images_start_size:
@@
-368,7
+367,7
@@
def main(arguments=None, stdout=sys.stdout):
if not docker_image_compatible(api, image_hash):
if args.force_image_format:
if not docker_image_compatible(api, image_hash):
if args.force_image_format:
- logger.warn("forcing incompatible image")
+ logger.warn
ing
("forcing incompatible image")
else:
logger.error("refusing to store " \
"incompatible format (use --force-image-format to override)")
else:
logger.error("refusing to store " \
"incompatible format (use --force-image-format to override)")
@@
-413,7
+412,7
@@
def main(arguments=None, stdout=sys.stdout):
api, args.retries,
filters=[['link_class', '=', 'docker_image_repo+tag'],
['name', '=', image_repo_tag],
api, args.retries,
filters=[['link_class', '=', 'docker_image_repo+tag'],
['name', '=', image_repo_tag],
- ['head_uuid', 'in',
collections
]])
+ ['head_uuid', 'in',
[c["uuid"] for c in collections]
]])
else:
existing_repo_tag = []
else:
existing_repo_tag = []