docker: Add "images" subcommand to docker.py
authorFam Zheng <famz@redhat.com>
Tue, 19 Jul 2016 13:20:43 +0000 (21:20 +0800)
committerFam Zheng <famz@redhat.com>
Wed, 20 Jul 2016 11:19:43 +0000 (19:19 +0800)
This is a wrapper for the 'docker images' command.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 1468934445-32183-9-git-send-email-famz@redhat.com

tests/docker/docker.py

index 40bda9de7bd09c4d6a7669204af462c6318767ea..222a1053fed5d57da827a9dd05eb34450313d3c3 100755 (executable)
@@ -179,6 +179,9 @@ class Docker(object):
             self._instances.remove(label)
         return ret
 
+    def command(self, cmd, argv, quiet):
+        return self._do([cmd] + argv, quiet=quiet)
+
 class SubCommand(object):
     """A SubCommand template base class"""
     name = None # Subcommand name
@@ -309,6 +312,12 @@ class CleanCommand(SubCommand):
         Docker().clean()
         return 0
 
+class ImagesCommand(SubCommand):
+    """Run "docker images" command"""
+    name = "images"
+    def run(self, args, argv):
+        return Docker().command("images", argv, args.quiet)
+
 def main():
     parser = argparse.ArgumentParser(description="A Docker helper",
             usage="%s <subcommand> ..." % os.path.basename(sys.argv[0]))