[node-patches] Change in ovirt-node[master]: ovirt_node: substitute remove_config usage with Config.unper...

asegurap at redhat.com asegurap at redhat.com
Mon Jun 23 15:01:17 UTC 2014


Antoni Segura Puimedon has uploaded a new change for review.

Change subject: ovirt_node: substitute remove_config usage with Config.unpersist
......................................................................

ovirt_node: substitute remove_config usage with Config.unpersist

Change-Id: I99bd4af6fc21247560f4667e43539d65ebe6a2e4
Signed-off-by: Antoni S. Puimedon <asegurap at redhat.com>
---
M src/ovirt/node/config/defaults.py
M src/ovirt/node/setup/rhn/rhn_model.py
2 files changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/76/29076/1

diff --git a/src/ovirt/node/config/defaults.py b/src/ovirt/node/config/defaults.py
index ddaa81d..fcdfc54 100644
--- a/src/ovirt/node/config/defaults.py
+++ b/src/ovirt/node/config/defaults.py
@@ -1146,9 +1146,7 @@
                 super(RemoveKdumpConfig, self).__init__()
 
             def commit(self):
-                from ovirtnode.ovirtfunctions import remove_config
-
-                remove_config("/etc/kdump.conf")
+                Config().unpersist("/etc/kdump.conf")
                 system.service("kdump", "stop")
                 fs.File('/etc/kdump.conf').touch()
 
diff --git a/src/ovirt/node/setup/rhn/rhn_model.py b/src/ovirt/node/setup/rhn/rhn_model.py
index 6361b4e..36db904 100644
--- a/src/ovirt/node/setup/rhn/rhn_model.py
+++ b/src/ovirt/node/setup/rhn/rhn_model.py
@@ -22,7 +22,7 @@
 from ovirt.node.config.defaults import NodeConfigFileSection
 from ovirt.node.utils import process
 from ovirt.node.utils.fs import Config
-from ovirtnode.ovirtfunctions import remove_config, unmount_config
+from ovirtnode.ovirtfunctions import unmount_config
 from urlparse import urlparse
 import sys
 import os.path
@@ -173,8 +173,9 @@
                 args.extend(extra_args)
 
                 self.logger.info("Registering to RHN account.....")
-                remove_config("/etc/sysconfig/rhn/systemid")
-                remove_config("/etc/sysconfig/rhn/up2date")
+                conf = Config()
+                conf.unpersist("/etc/sysconfig/rhn/systemid")
+                conf.unpersist("/etc/sysconfig/rhn/up2date")
                 logged_args = list(args)
                 remove_values_from_args = ["--password", "--proxyPassword"]
                 for idx, arg in enumerate(logged_args):
@@ -184,7 +185,6 @@
                 self.logger.debug(logged_args)
                 try:
                     subprocess.check_call(args)
-                    conf = Config()
                     conf.persist("/etc/sysconfig/rhn/up2date")
                     conf.persist("/etc/sysconfig/rhn/systemid")
                     self.logger.info("System %s sucessfully registered to %s" %
@@ -213,8 +213,9 @@
                 profilename = cfg["profile"]
                 proxy = cfg["proxy"]
                 proxyuser = cfg["proxyuser"]
+                conf = Config()
                 if os.path.exists("/etc/sysconfig/rhn/systemid"):
-                    remove_config("/etc/sysconfig/rhn/systemid")
+                    conf.unpersist("/etc/sysconfig/rhn/systemid")
 
                 extra_args = ['--force']
                 if not activationkey:
@@ -259,7 +260,7 @@
                         RHN().retrieveCert(cacert, location)
                     if os.path.isfile(location):
                         if os.stat(location).st_size > 0:
-                            Config().persist(location)
+                            conf.persist(location)
                         else:
                             raise RuntimeError("Error Downloading CA cert!")
 
@@ -277,7 +278,7 @@
                     smconf.append('/etc/rhsm/ca/candlepin-local.pem')
                 try:
                     subprocess.check_call(smconf)
-                    Config().persist("/etc/rhsm/rhsm.conf")
+                    conf.persist("/etc/rhsm/rhsm.conf")
                 except:
                     raise RuntimeError("Error updating subscription manager \
                                        configuration")
@@ -349,7 +350,6 @@
                     else:
                         raise RuntimeError("Registration Failed")
                 else:
-                    conf = Config()
                     conf.persist(rhsm_configs)
                     conf.persist("/etc/pki/consumer/key.pem")
                     conf.persist("/etc/pki/consumer/cert.pem")


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I99bd4af6fc21247560f4667e43539d65ebe6a2e4
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>



More information about the node-patches mailing list