mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
use require_if to check for username or AK instead of custom code (#20937)
the logical or parameter to require_if was introduced in #20220
This commit is contained in:
parent
770fb03157
commit
827723db90
1 changed files with 1 additions and 4 deletions
|
@ -490,6 +490,7 @@ def main():
|
||||||
),
|
),
|
||||||
required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ],
|
required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ],
|
||||||
mutually_exclusive = [ ['username', 'activationkey'] ],
|
mutually_exclusive = [ ['username', 'activationkey'] ],
|
||||||
|
required_if = [ [ 'state', 'present', ['username', 'activationkey'], True ] ],
|
||||||
)
|
)
|
||||||
|
|
||||||
rhsm.module = module
|
rhsm.module = module
|
||||||
|
@ -515,10 +516,6 @@ def main():
|
||||||
# Ensure system is registered
|
# Ensure system is registered
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
|
|
||||||
# Check for missing parameters ...
|
|
||||||
if not (activationkey or org_id or username or password):
|
|
||||||
module.fail_json(msg="Missing arguments, must supply an activationkey (%s) and Organization ID (%s) or username (%s) and password (%s)" % (activationkey, org_id, username, password))
|
|
||||||
|
|
||||||
# Register system
|
# Register system
|
||||||
if rhsm.is_registered and not force_register:
|
if rhsm.is_registered and not force_register:
|
||||||
if pool != '^$':
|
if pool != '^$':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue