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 f2f662f commit aae46b5
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 @@ -1518,13 +1518,14 @@ def register_to_cdn(self, pool_ids=None):
# 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 aae46b5

Please # to comment.