[node-patches] Change in ovirt-node[master]: RHN page:read configured RHN INFO from /etc/default/ovirt.

rbarry at redhat.com rbarry at redhat.com
Wed Aug 13 15:10:03 UTC 2014


Hello hadong,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/31471

to review the following change.

Change subject: RHN page:read configured RHN INFO from /etc/default/ovirt.
......................................................................

RHN page:read configured RHN INFO from /etc/default/ovirt.

Change-Id: Ibfa743a36d5361826a58be97f7ad753ab10095d0
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1078188
Signed-off-by: hadong <hadong at redhat.com>
---
M src/ovirt/node/setup/rhn/rhn_model.py
M src/ovirt/node/setup/rhn/rhn_page.py
2 files changed, 8 insertions(+), 28 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/71/31471/1

diff --git a/src/ovirt/node/setup/rhn/rhn_model.py b/src/ovirt/node/setup/rhn/rhn_model.py
index c7289d4..172630a 100644
--- a/src/ovirt/node/setup/rhn/rhn_model.py
+++ b/src/ovirt/node/setup/rhn/rhn_model.py
@@ -88,14 +88,14 @@
             raise RuntimeError("Error Downloading SSL Certificate!")
 
     def transaction(self, password, proxypass=None):
+        cfg = self.retrieve()
 
         class ConfigureRHNClassic(utils.Transaction.Element):
-            state = ("RHN" if RHN().retrieve()["rhntype"] == "rhn"
+            state = ("RHN" if cfg["rhntype"] == "rhn"
                      else "Satellite")
             title = "Configuring %s" % state
 
             def commit(self):
-                cfg = RHN().retrieve()
                 self.logger.debug(cfg)
                 rhntype = cfg["rhntype"]
                 serverurl = cfg["url"]
@@ -208,7 +208,6 @@
             title = "Registering to Server..."
 
             def commit(self):
-                cfg = RHN().retrieve()
                 self.logger.debug(cfg)
                 # rhntype = cfg["rhntype"]
                 org = cfg["org"]
@@ -373,7 +372,6 @@
                     self.logger.info("System %s sucessfully registered \
                                       to %s" % (profilename, serverurl))
 
-        cfg = self.retrieve()
         self.logger.debug(cfg)
         rhntype = cfg["rhntype"]
         cacert = cfg["ca_cert"]
diff --git a/src/ovirt/node/setup/rhn/rhn_page.py b/src/ovirt/node/setup/rhn/rhn_page.py
index 3aacb7e..ce8e5c2 100644
--- a/src/ovirt/node/setup/rhn/rhn_page.py
+++ b/src/ovirt/node/setup/rhn/rhn_page.py
@@ -142,33 +142,14 @@
         model["rhn.username"] = cfg["username"]
         model["rhn.type"] = cfg["rhntype"]
         model["rhn.profilename"] = cfg["profile"]
-        if RHN_XMLRPC_ADDR not in rhn_conf["serverURL"] and not sam_check():
-            model["rhn.url"] = rhn_conf["serverURL"] if rhn_conf["serverURL"]\
-                != "https://enter.your.server.url.here/XMLRPC" else ""
-            model["rhn.ca"] = rhn_conf["sslCACert"] if rhn_conf["sslCACert"] \
-                != "/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" else ""
-        elif sam_check():
-            if SAM_REG_ADDR not in rhn_conf["hostname"]:
-                model["rhn.url"] = "https://%s" % rhn_conf["hostname"]
-                if os.path.exists(CANDLEPIN_CERT_FILE):
-                    model["rhn.ca"] = CANDLEPIN_CERT_FILE
-        if "proxyUser" in rhn_conf and "proxyPassword" in rhn_conf:
-            if len(rhn_conf["proxyUser"]) > 0:
-                model["rhn.proxyuser"] = rhn_conf["proxyUser"]
-                model["rhn.proxypassword"] = rhn_conf["proxyPassword"]
-        elif "proxy_user" in rhn_conf and "proxy_password" in rhn_conf:
-            model["rhn.proxyuser"] = rhn_conf["proxy_user"]
-            model["rhn.proxypassword"] = rhn_conf["proxy_password"]
+        model["rhn.url"] = cfg["url"]
+        model["rhn.ca"] = cfg["ca_cert"]
+        model["rhn.proxyuser"] = cfg["proxyuser"]
         try:
-            p_server, p_port = rhn_conf["httpProxy"].rsplit(":", 1)
+            p_server, p_port = cfg["proxy"].rsplit(":", 1)
             model["rhn.proxyhost"] = p_server
             model["rhn.proxyport"] = p_port
         except:
-            try:
-                model["rhn.proxyhost"] = rhn_conf["proxy_hostname"]
-                model["rhn.proxyport"] = rhn_conf["proxy_port"]
-            except:
-                pass
             pass
         return model
 
@@ -298,7 +279,8 @@
                 return self._error_dialog
             else:
                 model = rhn_model.RHN()
-                # join proxy host/port
+                model.clear()
+                #join proxy host/port
                 self.logger.debug(proxyhost)
                 self.logger.debug(proxyport)
                 proxy = None


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

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



More information about the node-patches mailing list