← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~dmulford/cloud-init:add-null-check into cloud-init:master

 

David Mulford has proposed merging ~dmulford/cloud-init:add-null-check into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~dmulford/cloud-init/+git/cloud-init/+merge/332030

Both enabled and disabled repos need to be specified when using the rh_subscription module. A simple null check prevents this need.
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~dmulford/cloud-init:add-null-check into cloud-init:master.
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
index 7f36cf8..8720ff4 100644
--- a/cloudinit/config/cc_rh_subscription.py
+++ b/cloudinit/config/cc_rh_subscription.py
@@ -379,20 +379,22 @@ class SubscriptionManager(object):
         # Creating a list of repoids to be enabled
         enable_list = []
         enable_list_fail = []
-        for repoid in erepos:
-            if (repoid in inactive_repos):
-                enable_list.append("--enable={0}".format(repoid))
-            else:
-                enable_list_fail.append(repoid)
+        if not erepos is None:
+            for repoid in erepos:
+                if (repoid in inactive_repos):
+                    enable_list.append("--enable={0}".format(repoid))
+                else:
+                    enable_list_fail.append(repoid)
 
         # Creating a list of repoids to be disabled
         disable_list = []
         disable_list_fail = []
-        for repoid in drepos:
-            if repoid in active_repos:
-                disable_list.append("--disable={0}".format(repoid))
-            else:
-                disable_list_fail.append(repoid)
+        if not drepos is None:
+            for repoid in drepos:
+                if repoid in active_repos:
+                    disable_list.append("--disable={0}".format(repoid))
+                else:
+                    disable_list_fail.append(repoid)
 
         # Logging any repos that are already enabled or disabled
         if len(enable_list_fail) > 0:

Follow ups