When no pool quantity is set, then do not set quantity to 1 (#66807)

* Fixes #66478
* When no quantity is set, then candlepin server usually uses
  default value 1. When more quantities are required, then
  candlepin server can automatically choose correct minimal
  value.
pull/66915/head
Jiri Hnidek 5 years ago committed by GitHub
parent 9276dd2007
commit 6f1bb37feb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- redhat_subscription - do not set the default quantity to ``1`` when no quantity is provided (https://github.com/ansible/ansible/issues/66478)

@ -515,7 +515,9 @@ class Rhsm(RegistrationBase):
for pool_id, quantity in sorted(pool_ids.items()):
if pool_id in available_pool_ids:
args = [SUBMAN_CMD, 'attach', '--pool', pool_id, '--quantity', quantity]
args = [SUBMAN_CMD, 'attach', '--pool', pool_id]
if quantity is not None:
args.extend(['--quantity', to_native(quantity)])
rc, stderr, stdout = self.module.run_command(args, check_rc=True)
else:
self.module.fail_json(msg='Pool ID: %s not in list of available pools' % pool_id)
@ -839,8 +841,8 @@ def main():
module.fail_json(msg='Unable to parse pool_ids option.')
pool_id, quantity = list(value.items())[0]
else:
pool_id, quantity = value, 1
pool_ids[pool_id] = str(quantity)
pool_id, quantity = value, None
pool_ids[pool_id] = quantity
consumer_type = module.params["consumer_type"]
consumer_name = module.params["consumer_name"]
consumer_id = module.params["consumer_id"]

@ -557,8 +557,7 @@ Entitlement Type: Physical
[
'/testbin/subscription-manager',
'attach',
'--pool', 'ff8080816b8e967f016b8e99632804a6',
'--quantity', '1'
'--pool', 'ff8080816b8e967f016b8e99632804a6'
],
{'check_rc': True},
(0, '', '')
@ -567,8 +566,7 @@ Entitlement Type: Physical
[
'/testbin/subscription-manager',
'attach',
'--pool', 'ff8080816b8e967f016b8e99747107e9',
'--quantity', '1'
'--pool', 'ff8080816b8e967f016b8e99747107e9'
],
{'check_rc': True},
(0, '', '')
@ -658,7 +656,6 @@ Entitlement Type: Physical
'/testbin/subscription-manager',
'attach',
'--pool', 'ff8080816b8e967f016b8e99632804a6',
'--quantity', '1'
],
{'check_rc': True},
(0, '', '')

Loading…
Cancel
Save