[node-patches] Change in ovirt-node[ovirt-3.6]: Be smarter about failed RHNSM/Satellite registrations
fabiand at redhat.com
fabiand at redhat.com
Thu Nov 26 16:57:29 UTC 2015
Fabian Deutsch has uploaded a new change for review.
Change subject: Be smarter about failed RHNSM/Satellite registrations
......................................................................
Be smarter about failed RHNSM/Satellite registrations
Check subscription-manager when the page is loaded so we can keep
the selection on the radio widgets correct (instead of clearing
rhntype from the model), but catch unusual exit codes to reflect
whether it's not registered at all or not subscribed.
Also, auto attaching works now, so try to auto-attach in the
model.
Since subscription-manager doesn't return meaningful exit codes
(just 1 for all possible errors I've seen), check the output from
the exception.
Change-Id: Ied4c2774ab4c36b1d612fbf765f87e315adf73ac
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1280215
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/setup/rhn/rhn_page.py
1 file changed, 25 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/62/49262/1
diff --git a/src/ovirt/node/setup/rhn/rhn_page.py b/src/ovirt/node/setup/rhn/rhn_page.py
index 355cf81..155d0cd 100755
--- a/src/ovirt/node/setup/rhn/rhn_page.py
+++ b/src/ovirt/node/setup/rhn/rhn_page.py
@@ -20,6 +20,7 @@
# also available at http://www.gnu.org/copyleft/gpl.html.
from ovirt.node import plugins, valid, ui, utils
from ovirt.node.plugins import Changeset
+from ovirt.node.utils import process
from ovirt.node.utils.network import NodeNetwork
import rhn_model
@@ -105,13 +106,7 @@
"to use Red Hat Enterprise Linux with virtual " +
"guests subscriptions for your guests.")
else:
- rhntype = cfg["rhntype"]
- if "satellite" in rhntype:
- rhntype = rhntype.title()
- else:
- rhntype = rhntype.upper()
- rhn_msg = "RHN Registration\n\nRegistration Status: %s" \
- % rhntype
+ rhn_msg = self._get_status(cfg)
ws = [ui.Header("header[0]", rhn_msg),
ui.Entry("rhn.username", "Login:"),
@@ -245,6 +240,29 @@
progress_dialog.run()
return self.ui_content()
+ def _get_status(self, cfg):
+ if "satellite" in cfg["rhntype"]:
+ rhntype = cfg["rhntype"].title()
+ else:
+ rhntype = cfg["rhntype"].upper()
+
+ try:
+ cmd = ["subscription-manager", "status"]
+ process.check_call(cmd)
+ rhn_msg = "RHNSM Registration\n\nRegistration Status: %s" \
+ % rhntype
+
+ except process.CalledProcessError as e:
+ if "Status: Unknown" in e.output:
+ # Not registered or registration failed
+ pass
+ else:
+ rhn_msg = ("Registered to %s, but there are no "
+ "subscriptions attached or it is otherwise"
+ " invalid" % rhntype)
+
+ return rhn_msg
+
class ProxyDialog(ui.Dialog):
"""A dialog to input proxy information
--
To view, visit https://gerrit.ovirt.org/49262
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ied4c2774ab4c36b1d612fbf765f87e315adf73ac
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at redhat.com>
More information about the node-patches
mailing list