[virt-tools-list] [PATCH 1/7] urlfetcher: return repository information for distribution trees

Lubomir Rintel lkundrak at v3.sk
Fri Mar 23 09:17:00 UTC 2018


This adds a method to the Distro class that returns some extra data for
the distribution tree in case it is known to be a package repository (as
opposed to a directory of installed images).

Patches that determine the information for some Distro subclasses will
follow.
---
 virtinst/urlfetcher.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/virtinst/urlfetcher.py b/virtinst/urlfetcher.py
index 69c152a89..84555cfb6 100644
--- a/virtinst/urlfetcher.py
+++ b/virtinst/urlfetcher.py
@@ -580,6 +580,10 @@ class Distro(object):
     _xen_kernel_paths = []
     version_from_content = []
 
+    _repo_type = None
+    _repo_url = None
+    _repo_version = None
+
     def __init__(self, fetcher, arch, vmtype):
         self.fetcher = fetcher
         self.type = vmtype
@@ -635,6 +639,12 @@ class Distro(object):
         raise RuntimeError(_("Could not find boot.iso in %s tree." %
                            self.name))
 
+    def getRepoData(self):
+        if not self._repo_type:
+            raise RuntimeError(_("%s is not a repository." %
+                               self.fetcher.location))
+        return [self._repo_type, self._repo_url, self._repo_version]
+
     def _check_osvariant_valid(self, os_variant):
         return OSDB.lookup_os(os_variant) is not None
 
-- 
2.14.3




More information about the virt-tools-list mailing list