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

[6.15.z] Add conditioning for pool attach #16823

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions robottelo/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@
'current': 'Overall Status: Current',
'invalid': 'Overall Status: Invalid',
'insufficient': 'Overall Status: Insufficient',
'disabled': 'Overall Status: Disabled',
'unknown': 'Overall Status: Unknown',
}

Expand Down
19 changes: 12 additions & 7 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
RHSSO_RESET_PASSWORD,
RHSSO_USER_UPDATE,
SATELLITE_VERSION,
SM_OVERALL_STATUS,
)
from robottelo.exceptions import CLIFactoryError, DownloadFileError, HostPingFailed
from robottelo.host_helpers import CapsuleMixins, ContentHostMixins, SatelliteMixins
Expand Down Expand Up @@ -1513,8 +1514,6 @@ def install_tracer(self):

def register_to_cdn(self, pool_ids=None, enable_proxy=False):
"""Subscribe satellite to CDN"""
if pool_ids is None:
pool_ids = [settings.subscription.rhn_poolid]
self.remove_katello_ca()
cmd_result = self.register_contenthost(
org=None,
Expand All @@ -1527,11 +1526,17 @@ def register_to_cdn(self, pool_ids=None, enable_proxy=False):
raise ContentHostError(
f'Error during registration, command output: {cmd_result.stdout}'
)
cmd_result = self.subscription_manager_attach_pool(pool_ids)[0]
if cmd_result.status != 0:
raise ContentHostError(
f'Error during pool attachment, command output: {cmd_result.stdout}'
)
# Attach a pool only if the Org isn't SCA yet
sub_status = self.subscription_manager_status().stdout
if SM_OVERALL_STATUS['disabled'] not in sub_status:
if pool_ids in [None, []]:
pool_ids = [settings.subscription.rhn_poolid]
for pid in pool_ids:
int(pid, 16) # raises ValueError if not a HEX number
cmd_result = self.subscription_manager_attach_pool(pool_ids)
for res in cmd_result:
if res.status != 0:
raise ContentHostError(f'Pool attachment failed with output: {res.stdout}')

def ping_host(self, host):
"""Check the provisioned host status by pinging the ip of host
Expand Down