[elbe-devel] [PATCH 1/8] elbexml: add get_initvm_primary_mirror()

Torben Hohn torben.hohn at linutronix.de
Thu Sep 27 12:34:14 CEST 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>
---
 elbepack/elbexml.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index 4eb26b9f..8cda7987 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