16
registry.py
16
registry.py
@@ -559,6 +559,13 @@ for more detail on garbage collection read here:
|
|||||||
'Useful if your tag names are not in a fixed order.'),
|
'Useful if your tag names are not in a fixed order.'),
|
||||||
action='store_true'
|
action='store_true'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--plain',
|
||||||
|
help=('Turn plain output, one image:tag per line.'
|
||||||
|
'Useful if your want to send the results to another command.'),
|
||||||
|
action='store_true',
|
||||||
|
default=False
|
||||||
|
)
|
||||||
return parser.parse_args(args)
|
return parser.parse_args(args)
|
||||||
|
|
||||||
|
|
||||||
@@ -608,9 +615,11 @@ def delete_tags(
|
|||||||
def get_tags_like(args_tags_like, tags_list):
|
def get_tags_like(args_tags_like, tags_list):
|
||||||
result = set()
|
result = set()
|
||||||
for tag_like in args_tags_like:
|
for tag_like in args_tags_like:
|
||||||
|
if not args.plain:
|
||||||
print("tag like: {0}".format(tag_like))
|
print("tag like: {0}".format(tag_like))
|
||||||
for tag in tags_list:
|
for tag in tags_list:
|
||||||
if re.search(tag_like, tag):
|
if re.search(tag_like, tag):
|
||||||
|
if not args.plain:
|
||||||
print("Adding {0} to tags list".format(tag))
|
print("Adding {0} to tags list".format(tag))
|
||||||
result.add(tag)
|
result.add(tag)
|
||||||
return result
|
return result
|
||||||
@@ -700,6 +709,7 @@ def get_datetime_tags(registry, image_name, tags_list):
|
|||||||
"datetime": parse(image_age).astimezone(tzutc())
|
"datetime": parse(image_age).astimezone(tzutc())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not args.plain:
|
||||||
print('---------------------------------')
|
print('---------------------------------')
|
||||||
p = ThreadPool(4)
|
p = ThreadPool(4)
|
||||||
result = list(x for x in p.map(newer, tags_list) if x)
|
result = list(x for x in p.map(newer, tags_list) if x)
|
||||||
@@ -788,9 +798,9 @@ def main_loop(args):
|
|||||||
# loop through registry's images
|
# loop through registry's images
|
||||||
# or through the ones given in command line
|
# or through the ones given in command line
|
||||||
for image_name in image_list:
|
for image_name in image_list:
|
||||||
|
if not args.plain:
|
||||||
print("---------------------------------")
|
print("---------------------------------")
|
||||||
print("Image: {0}".format(image_name))
|
print("Image: {0}".format(image_name))
|
||||||
|
|
||||||
all_tags_list = registry.list_tags(image_name)
|
all_tags_list = registry.list_tags(image_name)
|
||||||
|
|
||||||
if not all_tags_list:
|
if not all_tags_list:
|
||||||
@@ -804,7 +814,11 @@ def main_loop(args):
|
|||||||
|
|
||||||
# print(tags and optionally layers
|
# print(tags and optionally layers
|
||||||
for tag in tags_list:
|
for tag in tags_list:
|
||||||
|
if not args.plain:
|
||||||
print(" tag: {0}".format(tag))
|
print(" tag: {0}".format(tag))
|
||||||
|
else:
|
||||||
|
print("{0}:{1}".format(image_name, tag))
|
||||||
|
|
||||||
if args.layers:
|
if args.layers:
|
||||||
for layer in registry.list_tag_layers(image_name, tag):
|
for layer in registry.list_tag_layers(image_name, tag):
|
||||||
if 'size' in layer:
|
if 'size' in layer:
|
||||||
|
|||||||
Reference in New Issue
Block a user