[gnome-settings-daemon/rhel/account-and-subman-plugins: 15/23] subman: Force re-subscribe if the admin already subscribed
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/rhel/account-and-subman-plugins: 15/23] subman: Force re-subscribe if the admin already subscribed
- Date: Tue, 13 Apr 2021 14:21:52 +0000 (UTC)
commit 5fcc4548295ed0f54fe8cb390f7bdeb22843b85d
Author: Ray Strode <rstrode redhat com>
Date: Tue Aug 25 10:34:03 2020 -0400
subman: Force re-subscribe if the admin already subscribed
It's possible for an admin to to half-enroll the system with RHN,
using the CLI tools.
Meaning, it's possible for them to register the system with the
service, but not attach to a purchased license for the machine,
the, so called, entitlements.
The subman module always does both halves of the registration process
in lock step. This means, if an admin tries to register using GNOME
while in a half-registered state, subman will fail because the first
step, the registration step, is already finished.
This commit addresses that problem by trying to unregister up front
before registering.
plugins/subman/gsd-subman-helper.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/plugins/subman/gsd-subman-helper.c b/plugins/subman/gsd-subman-helper.c
index f84e91bf..3931ef2e 100644
--- a/plugins/subman/gsd-subman-helper.c
+++ b/plugins/subman/gsd-subman-helper.c
@@ -78,7 +78,6 @@ _helper_unregister (GError **error)
g_autoptr(GVariantBuilder) proxy_options = NULL;
g_autoptr(GVariant) res = NULL;
- g_debug ("unregistering");
proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
@@ -235,6 +234,7 @@ main (int argc, char *argv[])
return G_IO_ERROR_INVALID_DATA;
}
if (g_strcmp0 (kind, "unregister") == 0) {
+ g_debug ("unregistering");
if (!_helper_unregister (&error)) {
g_printerr ("Failed to Unregister: %s\n", error->message);
return G_IO_ERROR_NOT_INITIALIZED;
@@ -304,6 +304,9 @@ main (int argc, char *argv[])
return G_IO_ERROR_INVALID_DATA;
}
+ g_debug ("trying to unregister in case machine is already registered");
+ _helper_unregister (NULL);
+
g_debug ("registering using activation key");
activation_keys = g_strsplit (activation_key, ",", -1);
res = g_dbus_proxy_call_sync (proxy,
@@ -327,7 +330,6 @@ main (int argc, char *argv[])
g_autoptr(GError) error_local = NULL;
g_autoptr(GVariant) res = NULL;
- g_debug ("registering using username and password");
if (username == NULL) {
g_printerr ("Required --username\n");
return G_IO_ERROR_INVALID_DATA;
@@ -340,6 +342,11 @@ main (int argc, char *argv[])
g_printerr ("Required --organisation\n");
return G_IO_ERROR_INVALID_DATA;
}
+
+ g_debug ("trying to unregister in case machine is already registered");
+ _helper_unregister (NULL);
+
+ g_debug ("registering using username and password");
res = g_dbus_proxy_call_sync (proxy,
"Register",
g_variant_new ("(sssa{ss}a{ss}s)",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]