diff options
author | Evgeni Golov <evgeni@golov.de> | 2017-02-06 19:53:12 +0100 |
---|---|---|
committer | Adrian Likins <alikins@redhat.com> | 2017-02-06 13:53:12 -0500 |
commit | 827723db90131ac8e8c3845dc90e361ea2353194 (patch) | |
tree | 41f2c4701aa0beb738dbda3a975917e7171a037b /lib/ansible/modules/packaging/os | |
parent | 770fb03157f6edaccc8481934569031b8e9c9f96 (diff) | |
download | ansible-827723db90131ac8e8c3845dc90e361ea2353194.tar.gz |
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
Diffstat (limited to 'lib/ansible/modules/packaging/os')
-rw-r--r-- | lib/ansible/modules/packaging/os/redhat_subscription.py | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/ansible/modules/packaging/os/redhat_subscription.py b/lib/ansible/modules/packaging/os/redhat_subscription.py index 0bcb9853f0..041da5c6e1 100644 --- a/lib/ansible/modules/packaging/os/redhat_subscription.py +++ b/lib/ansible/modules/packaging/os/redhat_subscription.py @@ -490,6 +490,7 @@ def main(): ), required_together = [ ['username', 'password'], ['activationkey', 'org_id'] ], mutually_exclusive = [ ['username', 'activationkey'] ], + required_if = [ [ 'state', 'present', ['username', 'activationkey'], True ] ], ) rhsm.module = module @@ -515,10 +516,6 @@ def main(): # Ensure system is registered 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 if rhsm.is_registered and not force_register: if pool != '^$': |