]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxc-ls: Optimize things a bit
authorStéphane Graber <stgraber@ubuntu.com>
Sun, 23 Mar 2014 03:26:59 +0000 (23:26 -0400)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 24 Mar 2014 22:29:34 +0000 (18:29 -0400)
Don't bother access information that the user didn't request.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lxc-ls.in

index 600085728d8f5fc6e0dbb96b95e730981fb0fb20..3384dcba379333007a09a4a94afef481483989b1 100755 (executable)
@@ -244,17 +244,17 @@ def get_containers(fd=None, base="/", root=False):
                 continue
 
             # Some extra field we may want
-            if 'state' in args.fancy_format or args.nesting:
+            if 'state' in args.fancy_format:
                 entry['state'] = state
 
-            if 'pid' in args.fancy_format or args.nesting:
+            if 'pid' in args.fancy_format:
                 entry['pid'] = "-"
                 if state == 'UNKNOWN':
                     entry['pid'] = state
                 elif container.init_pid != -1:
                     entry['pid'] = str(container.init_pid)
 
-            if 'autostart' in args.fancy_format or args.nesting:
+            if 'autostart' in args.fancy_format:
                 entry['autostart'] = "NO"
                 try:
                     if container.get_config_item("lxc.start.auto") == "1":
@@ -308,7 +308,7 @@ def get_containers(fd=None, base="/", root=False):
 
             # Get the IPs
             for family, protocol in {'inet': 'ipv4', 'inet6': 'ipv6'}.items():
-                if protocol in args.fancy_format or args.nesting:
+                if protocol in args.fancy_format:
                     entry[protocol] = "-"
 
                     if state == 'UNKNOWN':