From a27b0e2e6c73bb15b95994bc9cf7f052d2027729 Mon Sep 17 00:00:00 2001 From: Steve Milner Date: Thu, 25 May 2017 14:34:36 -0400 Subject: [PATCH] Atomic/containers.py: quiet supersedes json If atomic containers list is executed with both the json and quiet flag then quiet should take precedence. Closes: #1016 Approved by: baude --- Atomic/containers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Atomic/containers.py b/Atomic/containers.py index 06625b2..3be0157 100644 --- a/Atomic/containers.py +++ b/Atomic/containers.py @@ -143,7 +143,14 @@ class Containers(Atomic): if not any([x.running for x in container_objects]) and not self.args.all: return 0 - max_container_id = 12 if self.args.truncate else max([len(x.id) for x in container_objects]) + # Set to 12 when truncate + if self.args.truncate: + max_container_id = 12 + # Otherwise set to the max, falling back to 0 + else: + max_container_id = max([len(x.id) for x in container_objects] or [0]) + + # Quiet supersedes json output if self.args.quiet: for con_obj in container_objects: util.write_out(con_obj.id[0:max_container_id])