[sandbox v2 1/5] virt-sandbox-image: remove the download command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The download command is now merged with the create one. There is no
real reason to keep those two separate.
---
 libvirt-sandbox/image/cli.py                  | 14 --------------
 libvirt-sandbox/image/sources/DockerSource.py |  3 +++
 libvirt-sandbox/image/sources/Source.py       | 11 -----------
 3 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/libvirt-sandbox/image/cli.py b/libvirt-sandbox/image/cli.py
index a43da62..4500713 100755
--- a/libvirt-sandbox/image/cli.py
+++ b/libvirt-sandbox/image/cli.py
@@ -64,12 +64,6 @@ def debug(msg):
 def info(msg):
     sys.stdout.write(msg)
 
-def download(args):
-    tmpl = template.Template.from_uri(args.template)
-    source = tmpl.get_source_impl()
-    source.download_template(template=tmpl,
-                             templatedir=args.template_dir)
-
 def delete(args):
     tmpl = template.Template.from_uri(args.template)
     source = tmpl.get_source_impl()
@@ -178,13 +172,6 @@ Example supported URI formats:
 """)
     return parser
 
-def gen_download_args(subparser):
-    parser = gen_command_parser(subparser, "download",
-                                _("Download template data"))
-    requires_template(parser)
-    requires_template_dir(parser)
-    parser.set_defaults(func=download)
-
 def gen_delete_args(subparser):
     parser = gen_command_parser(subparser, "delete",
                                 _("Delete template data"))
@@ -225,7 +212,6 @@ def main():
     parser = argparse.ArgumentParser(description="Sandbox Container Image Tool")
 
     subparser = parser.add_subparsers(help=_("commands"))
-    gen_download_args(subparser)
     gen_delete_args(subparser)
     gen_create_args(subparser)
     gen_run_args(subparser)
diff --git a/libvirt-sandbox/image/sources/DockerSource.py b/libvirt-sandbox/image/sources/DockerSource.py
index 41df7a7..93d7f17 100644
--- a/libvirt-sandbox/image/sources/DockerSource.py
+++ b/libvirt-sandbox/image/sources/DockerSource.py
@@ -245,6 +245,9 @@ class DockerSource(Source):
         if format is None:
             format = "qcow2"
         self._check_disk_format(format)
+
+        self.download_template(template, templatedir)
+
         imagelist = self._get_image_list(template, templatedir)
         imagelist.reverse()
 
diff --git a/libvirt-sandbox/image/sources/Source.py b/libvirt-sandbox/image/sources/Source.py
index 444baa3..708f2aa 100644
--- a/libvirt-sandbox/image/sources/Source.py
+++ b/libvirt-sandbox/image/sources/Source.py
@@ -35,17 +35,6 @@ class Source():
         pass
 
     @abstractmethod
-    def download_template(self, template, templatedir):
-        """
-        :param template: libvirt_sandbox.template.Template object
-        :param templatedir: local directory path in which to store the template
-
-        Download a template from the registry, storing it in the local
-        filesystem
-        """
-        pass
-
-    @abstractmethod
     def create_template(self, template, templatedir,
                         connect=None, format=None):
         """
-- 
2.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]