Seyeong Kim has proposed merging ~seyeongkim/maas:lp2020397 into maas:master.

Commit message:
At least We need to handle custom images which is not included ubuntu, centos 
rhel

Requested reviews:
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #2020397 in MAAS: "Custom images which worked ok is not working with 3.2"
  https://bugs.launchpad.net/maas/+bug/2020397

For more details, see:
https://code.launchpad.net/~seyeongkim/maas/+git/maas/+merge/443937
-- 
Your team MAAS Maintainers is requested to review the proposed merge of 
~seyeongkim/maas:lp2020397 into maas:master.
diff --git a/src/maasserver/preseed.py b/src/maasserver/preseed.py
index 94d77c0..ae5f055 100644
--- a/src/maasserver/preseed.py
+++ b/src/maasserver/preseed.py
@@ -662,18 +662,30 @@ def get_custom_image_dependency_validation(node, base_osystem):
     cmd = {}
     err_msg = "not detected, MAAS will not be able to configure this machine properly"
 
-    package_manager = PACKAGE_MANAGER_PER_OS[base_osystem]
-
-    for priority, dep in enumerate(package_manager.deps, start=98):
-        in_target = f'{package_manager.package_tool} {dep} || (echo "{dep} {err_msg}" && exit 1)'
-        cmd[f"{priority}-validate-custom-image-has-{dep}"] = [
-            "curtin",
-            "in-target",
-            "--",
-            "bash",
-            "-c",
+    try:
+        package_manager = PACKAGE_MANAGER_PER_OS[node.get_osystem()]
+
+        for priority, dep in enumerate(package_manager.deps, start=98):
+            in_target = f'{package_manager.package_tool} {dep} || \
+                    (echo "{dep} {err_msg}" && exit 1)'
+            cmd[f"{priority}-validate-custom-image-has-{dep}"] = [
+                "curtin",
+                "in-target",
+                "--",
+                "bash",
+                "-c",
+                in_target,
+            ]
+    except Exception:
+        err_msg_custom = "This image is cutomized image,\
+ MAAS will not be able to configure this machine properly"
+        in_target = f"=================\n{err_msg_custom}\n=================\n"
+        cmd[f"warning"] = [
+            "echo",
             in_target,
         ]
+        pass
+
     return cmd
 
 
-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : sts-sponsors@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to