mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-08 13:07:19 +00:00
redhat_subscription: require credentials only when needed (#5664)
The module currently has a static 'required_if' statement for its
parameters that forces any of 'username' or 'activationkey' or 'token'
in case state=present; while this is generally a good idea, it can be
an extra requirements in some cases. In particular, if the system is
already registered, there is no need for credentials -- some of the
operations of the module, such as manipulating pools, can be done
perfectly without credentials.
Hence:
- change the static 'required_if' to require credentials only when
forcing the registration
- check for credentials manually when a registration is needed, i.e.
on an unregistered system; the fail message is the same as the one
shown by 'required_if'
Adapt the tests to this new situation:
- test_without_required_parameters now needs to mock an unregistered
system
- add a new version of test_without_required_parameters to test an
already registered system
- add a simple test case for only state=present usable on an already
registered system
- remove the credentials from a test case for pool attachment that
mocks an already registered system
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| .keep | ||
| 4387-nmcli-mtu-for-vlan-connection-fix.yml | ||
| 5664-redhat_subscription-credentials-when-needed.yaml | ||
| 6049-dconf-strings.yml | ||
| 6111-influxdb_user-check-mode.yaml | ||
| 6112-fix_key_error_in_gitlab_runner_creation_update.yml | ||
| 6114-memset-add-url-error-handling.yml | ||
| 6117-remove-stormssh-depend.yml | ||
| 6118-jail-plugin-fix-default-inventory_hostname.yml | ||
| 6119-opkg-update.yaml | ||
| 6122-redhat_subscription-subscribe-via-dbus.yaml | ||
| 6127-yarn-ignore-warnings.yml | ||
| 6131-fix-interfaces_file-for-no-leading-spaces.yml | ||
| 6138-fix-yarn-global.yml | ||
| 6149-openbsd_pkg-term.yml | ||
| 6154-znode-optional-tls.yml | ||
| 6160-add-command-make-output.yml | ||
| 6165-nmap-port.yml | ||
| 6180-replace-deprecated-badzipfile.yml | ||
| 6211-rhsm-require-root.yml | ||
| xxxx-ldap-ca-cert-file.yml | ||