New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Simple Content Access UX #3828
Conversation
We can't merge this until subscription-manager 1.29.24 has been released an is available n the compose. So setting the blocked label. |
25b2a4d
to
c83c904
Compare
/kickstart-test --testtype smoke |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
{}, | ||
{}, | ||
locale) | ||
registration_data = private_register_proxy.Register(self._organization, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, move arguments of the function on the new line to fix the indentation.
registration_data = private_register_proxy.Register(
self._organization,
self._username,
...
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, that looks much better. :)
log.debug("subscription: registered with username and password") | ||
return registration_data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new return value is not documented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, right, thanks! Fixed. :)
@@ -666,6 +692,9 @@ def _system_unregistered_callback(self): | |||
# script, or else it will be run by the target system | |||
# provisioning task | |||
self._set_satellite_provisioning_script(None) | |||
# also when we are no longer registered then we are are | |||
# thus no longer in Simple Content Access mode | |||
self.set_simple_content_access_enabled(False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these data should be ideally represented by another object, that we could easily drop and replace by another one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I'm afraid this is as far as we can reasonably go given the scope and timeline of this fix, there is definitely some room for improvement in the future.
Ideally the SCA mode value would be part of the data describing attached subscriptions but that's handled much later in the flow and with a separate task from the registration one, so I didn't find an easy way of putting it there without possibly changing quite a bit of code.
Still, there is a a ray of hope in the form of a forthcoming RHSM API improvement that could potentially remove the need to call AutoAttach()
and maybe even GetPools()
. Then we could just have a single register task, that would do all whats needed and would return all the necessary data in one go. Would could then feed that data into a single DBus struct describing what happened and be done with it, potentially making the code much simpler and smaller. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found some nitpicks but other than that it looks good to me.
:param str registration_data_json: registration data in JSON format | ||
:return: True if data inicates SCA enabled, False otherwise | ||
""" | ||
# we can't try to detect SCA mode if we don't have any registration data data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo ... data data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. :)
elif content_access_mode == "entitlement": | ||
# SCA explicitely not enabled | ||
return False | ||
else: | ||
log.warning("contentAccessMode mode not set to known value:") | ||
log.warning(content_access_mode) | ||
# unknown mode or missing data -> not SCA | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we really interested in the value? Wouldn't it be sufficient to just log the value if it is not equal to "org_environment"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Past experience with RHSM & the closely related Candlepin and Satellite APIs indicates a reasonable potential for unexpected values coming back from the API & that it's very useful to have debug data available when this happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You would still have the log there. It's just one for both branches which seems fine to me? If you want to still have info that entitlement
is possible than comment in the code should be enough for that.
parse_method = RegisterAndSubscribeTask._detect_sca_from_registration_data | ||
# the parsing method should be able to survive also getting an empty string | ||
# or even None, returning False | ||
assert not parse_method("") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should test here
assert <something> is True/False
Otherwise anything is returned (except False
and None
) will be taken as correct output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't sound right, though. Assert checks a bool value. The function returns a bool. That makes it correct, unless you also want to ensure the function returns only bools and nothing else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that you want to make that sure. The point is that False
!= None
which is not that hard to have (missing return statement) and it could catch a bug this way.
def __init__(self, rhsm_observer, subscription_request, system_purpose_data, | ||
registered_callback, registered_to_satellite_callback, | ||
subscription_attached_callback, subscription_data_callback, | ||
satellite_script_callback, config_backup_callback): | ||
simple_content_access_callback, subscription_attached_callback, | ||
subscription_data_callback, satellite_script_callback, | ||
config_backup_callback): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not for this PR but this is a bit too many parameters. It would be great to somehow cleanup this when backported to master
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, doing something about this is definitely planned for the upstream version of Satellite support. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good to me, +1 to the other reviews.
I am slightly confused about how "simple content access" and "SCA" are mixed pretty freely, I think you coudl have saved a lot of typing by always using SCA, but never mind :)
Add support for detecting Single Content Access mode from data returned by the RHSM DBus API Register() and RegisterWithActivationKeys() methods. Related: rhbz#2048449
c83c904
to
75411b4
Compare
Add the IsSimpleContentAccessEnabled property to the Subscription module DBus interface. This property is set to True if SCA mode is detected after a successfully registration attempt. The property is reset back to the initial state (False) on unregistration. Related: rhbz#2048449
Instead of showing "No subscriptions attached" on the Connect to Red Hat screen in SCA mode show "Subscribed in Simple Content Access mode." instead. Resolves: rhbz#2048449
The necessary API support for returning Simple Content Access mode as part of registration data was only added in subscription-manager 1.29.23. Unfortunately this version also contains the auto-attach regression (https://bugzilla.redhat.com/show_bug.cgi?id=2049139), so we need at least 1.29.24, which should have both the necessary API support as well as the regression fixed. Related: rhbz#2048449
75411b4
to
c042039
Compare
/kickstart-test --testtype smoke |
https://bugzilla.redhat.com/show_bug.cgi?id=2049139 with subscription-manager-1.29.25-1.el9 in ON_QA, so this PR is not blocked by subscription-manager any more. |
/kickstart-test --testtype smoke |
Indeed, dropping the blocked label. |
/kickstart-test --testtype smoke |
2 similar comments
/kickstart-test --testtype smoke |
/kickstart-test --testtype smoke |
This can be ported to Fedora only once Satellite support has been ported. |
Show a proper status message instead of a confusing (even if correct) message about no subscription being attached if install time registration is done in Simple Content Access mode.
This is achieved by parsing the data returned by the register methods of the RHSM DBus, exposing this via a DBus property of the Subscription module, which is then used by the GUI to display the appropriate string.