[node-patches] Change in ovirt-node[master]: Use the new codebase for autoinstalls, check for None

rbarry at redhat.com rbarry at redhat.com
Thu Jul 31 14:21:40 UTC 2014


Ryan Barry has uploaded a new change for review.

Change subject: Use the new codebase for autoinstalls, check for None
......................................................................

Use the new codebase for autoinstalls, check for None

Don't try to blindly check the length of variables which may be
None, and don't use the old codebase to get kernel commandline
arguments when we can use the new codebase.

Change-Id: I198eb9438f10c748aa0323ef398cfa21dea9896f
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1120650
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M plugins/cim_autoinstall.py
M plugins/puppet_autoinstall.py
M plugins/snmp_autoinstall.py
3 files changed, 10 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/07/30907/1

diff --git a/plugins/cim_autoinstall.py b/plugins/cim_autoinstall.py
index 6d3cb0b..20ca089 100644
--- a/plugins/cim_autoinstall.py
+++ b/plugins/cim_autoinstall.py
@@ -21,17 +21,15 @@
 
 from ovirt.node.utils.console import TransactionProgress
 from ovirt.node.setup.cim import cim_model
-import ovirtnode.ovirtfunctions as _functions
+from ovirt.node.utils import system
 
-args = _functions.get_cmdline_args()
-
-cim_pw = args.get("cim_passwd")
+args = system.kernel_cmdline_args()
 
 if __name__ == "__main__":
     cim = cim_model.CIM()
-    if len(cim_pw) > 0:
+    if "cim_passwd" in args and len(args["cim_passwd"]) > 0:
         cim.update(enabled=True)
-        tx = cim.transaction(cim_password=cim_pw)
+        tx = cim.transaction(cim_password=args["cim_passwd"])
         TransactionProgress(tx, is_dry=False).run()
         # clear ovirt_cim_passwd from /etc/default/ovirt
         pw_keys = ("OVIRT_CIM_PASSWD")
diff --git a/plugins/puppet_autoinstall.py b/plugins/puppet_autoinstall.py
index 1853078..f825394 100644
--- a/plugins/puppet_autoinstall.py
+++ b/plugins/puppet_autoinstall.py
@@ -18,11 +18,11 @@
 # also available at http://www.gnu.org/copyleft/gpl.html.
 
 from ovirt.node.setup.puppet.puppet_page import *
-import ovirtnode.ovirtfunctions as _functions
+from ovirt.node.utils import system
 from ovirt.node.plugins import Changeset
 import re
 
-args = _functions.get_cmdline_args()
+args = system.kernel_cmdline_args()
 keys = ["puppet_enabled", "puppet_server", "puppet_certname"]
 changes = dict((re.sub(r'_', r'.', key), args[key]) for key in keys
                if key in args)
diff --git a/plugins/snmp_autoinstall.py b/plugins/snmp_autoinstall.py
index dd86f7a..5a96658 100644
--- a/plugins/snmp_autoinstall.py
+++ b/plugins/snmp_autoinstall.py
@@ -19,17 +19,15 @@
 
 from ovirt.node.utils.console import TransactionProgress
 from ovirt.node.setup.snmp import snmp_model
-import ovirtnode.ovirtfunctions as _functions
+from ovirt.node.utils import system
 
-args = _functions.get_cmdline_args()
-
-snmp_pw = args.get("snmp_password")
+args = system.kernel_cmdline_args()
 
 if __name__ == "__main__":
     snmp = snmp_model.SNMP()
-    if len(snmp_pw) > 0:
+    if "snmp_password" in args and len(args["snmp_password"]) > 0:
         snmp.update(enabled=True)
-        tx = snmp.transaction(snmp_password=snmp_pw)
+        tx = snmp.transaction(snmp_password=args["snmp_passwd"])
         TransactionProgress(tx, is_dry=False).run()
         # clear ovirt_snmp_passwd from /etc/default/ovirt
         pw_keys = ("OVIRT_SNMP_PASSWORD",)


-- 
To view, visit http://gerrit.ovirt.org/30907
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I198eb9438f10c748aa0323ef398cfa21dea9896f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list