Skip to content

Commit

Permalink
this patch makes sub-man explode when non-SCA mode is detected
Browse files Browse the repository at this point in the history
  • Loading branch information
m-horky committed Apr 23, 2024
1 parent 3cc6ee7 commit d0d5d87
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 409 deletions.
5 changes: 4 additions & 1 deletion src/subscription_manager/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,10 @@ def _sync_with_server(
)
else:
if "contentAccessMode" in current_owner:
return current_owner["contentAccessMode"]
mode = current_owner["contentAccessMode"]
if mode != "org_environment":
raise RuntimeError("IS NOT SCA")
return mode
else:
log.debug(
"The owner returned from the server did not contain a "
Expand Down
70 changes: 0 additions & 70 deletions src/subscription_manager/cli_command/autoheal.py

This file was deleted.

90 changes: 0 additions & 90 deletions src/subscription_manager/cli_command/redeem.py

This file was deleted.

22 changes: 3 additions & 19 deletions src/subscription_manager/cli_command/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,6 @@ def __init__(self):
dest="release",
help=_("set a release version"),
)
self.parser.add_argument(
"--autosubscribe",
action="store_true",
help=_("Deprecated, see --auto-attach"),
)
self.parser.add_argument(
"--auto-attach",
action="store_true",
dest="autoattach",
help=_("automatically attach compatible subscriptions to this system"),
)
self.parser.add_argument(
"--force",
action="store_true",
Expand All @@ -135,7 +124,6 @@ def __init__(self):
)

def _validate_options(self):
self.autoattach = self.options.autosubscribe or self.options.autoattach
if self.is_registered() and not self.options.force:
system_exit(os.EX_USAGE, _("This system is already registered. Use --force to override"))
elif self.options.consumername == "":
Expand All @@ -148,12 +136,12 @@ def _validate_options(self):
)
elif self.options.environments and self.options.activation_keys:
system_exit(os.EX_USAGE, _("Error: Activation keys do not allow environments to be specified."))
elif self.autoattach and self.options.activation_keys:
elif self.options.activation_keys:
system_exit(os.EX_USAGE, _("Error: Activation keys cannot be used with --auto-attach."))
# 746259: Don't allow the user to pass in an empty string as an activation key
elif self.options.activation_keys and "" in self.options.activation_keys:
system_exit(os.EX_USAGE, _("Error: Must specify an activation key"))
elif self.options.service_level and not self.autoattach:
elif self.options.service_level:
system_exit(os.EX_USAGE, _("Error: Must use --auto-attach with --servicelevel."))
elif self.options.activation_keys and not self.options.org:
system_exit(os.EX_USAGE, _("Error: Must provide --org with activation keys."))
Expand Down Expand Up @@ -402,13 +390,9 @@ def _do_command(self):
# TODO: grab the list of valid options, and check
self.cp.updateConsumer(consumer["uuid"], release=self.options.release)

if self.autoattach:
self._do_auto_attach(consumer)

if (
self.options.consumerid
or self.options.activation_keys
or self.autoattach
or self.cp.has_capability(CONTENT_ACCESS_CERT_CAPABILITY)
):
log.debug("System registered, updating entitlements if needed")
Expand All @@ -419,7 +403,7 @@ def _do_command(self):
self._upload_profile(consumer)

subscribed = 0
if self.options.activation_keys or self.autoattach:
if self.options.activation_keys:
# update with the latest cert info
self.sorter = inj.require(inj.CERT_SORTER)
self.sorter.force_cert_check()
Expand Down
Loading

0 comments on commit d0d5d87

Please sign in to comment.