Skip to content
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

feat: Require SCA for registration #3430

Merged
merged 2 commits into from
Aug 15, 2024

Conversation

m-horky
Copy link
Contributor

@m-horky m-horky commented Jul 15, 2024

  • Card ID: CCT-612

@cnsnyder cnsnyder requested review from a team and jirihnidek and removed request for a team July 15, 2024 13:05
@m-horky m-horky force-pushed the mhorky/cct-612/sca-only-registration branch 4 times, most recently from 7b731e6 to 2c73195 Compare July 15, 2024 13:38
Copy link

github-actions bot commented Jul 15, 2024

Coverage

Coverage (computed on Fedora latest) •
FileStmtsMissCoverMissing
rhsmlib/services
   register.py1132379%31, 67, 75–76, 78–79, 81–82, 84–85, 117, 170, 192, 203–204, 206, 221, 223, 235, 248, 268, 275, 277
TOTAL18339466874% 

Tests Skipped Failures Errors Time
2630 14 💤 0 ❌ 0 🔥 36.829s ⏱️

@m-horky m-horky marked this pull request as ready for review July 15, 2024 17:05
@cnsnyder cnsnyder requested a review from a team July 15, 2024 17:05
Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall it is good idea. I have small request that is related to the case, when user is not member of any organization.

test/rhsmlib/services/test_register.py Show resolved Hide resolved
@m-horky
Copy link
Contributor Author

m-horky commented Jul 30, 2024

@jirihnidek The no-org state is already handled on higher levels. For both CLI and D-Bus, the determine_owner_key has a no_owner_cb callback that stops the registration.

CLI:

owner_key = service.determine_owner_key(
username=self.username, get_owner_cb=self._get_owner_cb, no_owner_cb=self._no_owner_cb
)

def _no_owner_cb(username):
"""
Method called, when there it no owner in the list of owners for given user
:return: None
"""
system_exit(1, _("{name} cannot register with any organizations.").format(name=username))

D-Bus:

organization: str = service.determine_owner_key(
username=connection_options["username"],
get_owner_cb=self._on_multiple_organizations,
no_owner_cb=self._on_no_organization,
)

def _on_no_organization(self, username: str) -> None:
"""A function to call when a member is not part of any organization.
:raises NoOrganizationException:
"""
raise NoOrganizationException(username=username)

@jirihnidek
Copy link
Contributor

It looks OK to me, but it would be to modify cockpit integration tests ... I can see that you already try to do it here: candlepin/subscription-manager-cockpit#70 but some tests are still failing...

@m-horky
Copy link
Contributor Author

m-horky commented Jul 30, 2024

I've tried to fix the Cockpit tests, but it got to the limits of the timebox I set up for it, see downstream CCT-624 for details.

Copy link
Contributor

@ptoscano ptoscano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally good, few things to change

src/rhsmlib/services/register.py Outdated Show resolved Hide resolved
src/rhsmlib/services/register.py Show resolved Hide resolved
test/rhsmlib/services/test_register.py Outdated Show resolved Hide resolved
test/rhsmlib/services/test_register.py Outdated Show resolved Hide resolved
@m-horky m-horky force-pushed the mhorky/cct-612/sca-only-registration branch from 2c73195 to c81c445 Compare August 8, 2024 14:56
@m-horky m-horky force-pushed the mhorky/cct-612/sca-only-registration branch from f0bf032 to 409d401 Compare August 13, 2024 15:44
@m-horky m-horky force-pushed the mhorky/cct-612/sca-only-registration branch from 409d401 to 7ee4459 Compare August 13, 2024 16:01
@ptoscano
Copy link
Contributor

Thank you for all the updates, now it LGTM. After all the cockpit tests were fixed/adapted, now this works for cockpit too :D

@jirihnidek would you like to take a second look at it, after the latest changes?

Copy link
Contributor

@jirihnidek jirihnidek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jirihnidek jirihnidek merged commit f7693bc into main Aug 15, 2024
14 checks passed
@jirihnidek jirihnidek deleted the mhorky/cct-612/sca-only-registration branch August 15, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants