[node-patches] Change in ovirt-node[master]: Call ConfigurureSubscriptionManager in rhn_model

rbarry at redhat.com rbarry at redhat.com
Tue Dec 1 15:49:59 UTC 2015


Ryan Barry has uploaded a new change for review.

Change subject: Call ConfigurureSubscriptionManager in rhn_model
......................................................................

Call ConfigurureSubscriptionManager in rhn_model

All the logic for SAM and Satellite 6 got broken out into a new
class with the rewrite, but it was missed in the transaction. Add
it if the right model values are present.

Also fix a typo with rhn_type (which doesn't exist) vs rhntype.

Remove the ca cert when removing the old configs so we grab a new
one if the registration is changed from SAM to Satellite 6 or
something (unlikely, but happens in QE)

Change-Id: I14eb998cd1fb12d6b393232a17199aac55b6331b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1280217
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1276597
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/rhn/rhn_model.py
1 file changed, 15 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/21/49521/1

diff --git a/src/ovirt/node/setup/rhn/rhn_model.py b/src/ovirt/node/setup/rhn/rhn_model.py
index 250e19a..db6a223 100755
--- a/src/ovirt/node/setup/rhn/rhn_model.py
+++ b/src/ovirt/node/setup/rhn/rhn_model.py
@@ -312,6 +312,13 @@
 
                 [scrub(f) for f in configs]
 
+                # Don't rely on Vars.location, since it may not be set, but we
+                # should remove this regardless
+                cert_path = "/etc/rhsm/ca/candlepin-local.pem"
+                if os.path.exists(cert_path):
+                    Config().unpersist(cert_path)
+                    os.unlink(cert_path)
+
         class ConfigureSubscriptionManager(utils.Transaction.Element):
             title = "Configuring subscription manager"
 
@@ -328,8 +335,9 @@
 
                     # Default to /rhsm for Satellite 6
                     if cfg["ca_cert"].endswith(".pem") and \
-                       cfg["rhn_type"] == "satellite":
+                       cfg["rhntype"] == "satellite":
                         prefix = "/rhsm"
+
                 else:
                     # Default values for public SAM
                     host = "subscription.rhn.redhat.com"
@@ -345,7 +353,7 @@
                 # Figure out what other arguments need to be set
                 # If there's a ca certificate or it's satellite, it's sat6
                 if cfg["ca_cert"] and not cfg["ca_cert"].endswith(".pem") or \
-                   cfg["rhn_type"] == "satellite":
+                   cfg["rhntype"] == "satellite":
                     mapping["--server.prefix"] = prefix
                 else:
                     prefix = "%s/%s" % (host, prefix) if prefix else \
@@ -501,13 +509,18 @@
                 tx.extend([RaiseError("Registration to Satellite 6 requires "
                                       "an organization to be set")])
                 return tx
+
             if cfg["proxy"]:
                 tx.append(ConfigureSAMProxy())
+
             if cfg["ca_cert"]:
                 Vars.ca_cert = cfg["ca_cert"]
                 Vars.location = "/etc/rhsm/ca/candlepin-local.pem"
                 tx.append(DownloadCertificate())
 
+            if cfg["url"]:
+                tx.append(ConfigureSubscriptionManager())
+
             tx.extend([PrepareSAM(),
                        RegisterSAM()
                        ])


-- 
To view, visit https://gerrit.ovirt.org/49521
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I14eb998cd1fb12d6b393232a17199aac55b6331b
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