Skip to content

Commit

Permalink
Improve pool validations a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
vsedmik committed Nov 5, 2024
1 parent 4840f5c commit 1c51a5a
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,13 +1529,14 @@ def register_to_cdn(self, pool_ids=None, enable_proxy=False):
# 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 is None:
if pool_ids in [None, []]:
pool_ids = [settings.subscription.rhn_poolid]
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}'
)
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

0 comments on commit 1c51a5a

Please sign in to comment.