[elbe-devel] [PATCH v2 01/12] elbexml: add get_initvm_primary_mirror()

Torben Hohn torben.hohn at linutronix.de
Mon Nov 12 17:43:02 CET 2018


the new buildrepo command needs to obtain the mirror, of the initvm.
add a function that allows to get it.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/elbexml.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index ad78a925..26786c3c 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -106,6 +106,19 @@ class ElbeXML(object):
 
         return True
 
+    def get_initvm_primary_mirror(self, cdrompath):
+        if self.xml.has("initvm/mirror/primary_host"):
+            m = self.node("initvm/mirror")
+
+            mirror = m.text("primary_proto") + "://"
+            mirror += m.text("primary_host") + "/"
+            mirror += m.text("primary_path")
+
+        elif self.xml.has("initvm/mirror/cdrom") and cdrompath:
+            mirror = "file://%s" % cdrompath
+
+        return mirror.replace("LOCALMACHINE", "10.0.2.2")
+
     def get_primary_mirror(self, cdrompath):
         if self.prj.has("mirror/primary_host"):
             m = self.prj.node("mirror")
-- 
2.11.0




More information about the elbe-devel mailing list