1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/plugins
patchback[bot] 47b8df8019
[PR #5664/bbd68e26 backport][stable-6] redhat_subscription: require credentials only when needed (#6222)
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 bbd68e26a2)

Co-authored-by: Pino Toscano <ptoscano@redhat.com>
2023-03-22 20:56:22 +01:00
..
action Unflatmap community.general (#5461) 2022-11-02 20:42:29 +00:00
become Make pfexec become usable for illumos (#3889) 2022-10-05 08:26:40 +02:00
cache [PR #5940/2b8ac3c6 backport][stable-6] Remove unneccessary imports (#5976) 2023-02-12 20:22:44 +01:00
callback [PR #5940/2b8ac3c6 backport][stable-6] Remove unneccessary imports (#5976) 2023-02-12 20:22:44 +01:00
connection [PR #6118/9a97bc7c backport][stable-6] Add 'inventory_hostname' to the jail plugin documentation (#6137) 2023-03-03 23:10:59 +01:00
doc_fragments [PR #6185/512bf4b7 backport][stable-6] ldap moduls: add optional ca_cert_file option (#6217) 2023-03-22 13:15:48 +01:00
filter [PR #6043/c168f9c3 backport][stable-6] JC: Add plugin parser functionality to JC Filter Plugin (#6047) 2023-02-23 17:12:09 +01:00
inventory [PR #6165/bf8f2950 backport][stable-6] Adding support for -p option to specify port(s) to scan (#6207) 2023-03-19 13:54:53 +01:00
lookup [PR #6074/b6492911 backport][stable-6] stop passing loader/dataloader since it has been deprecated by ansible (#6092) 2023-02-25 15:39:48 +01:00
module_utils [PR #6185/512bf4b7 backport][stable-6] ldap moduls: add optional ca_cert_file option (#6217) 2023-03-22 13:15:48 +01:00
modules [PR #5664/bbd68e26 backport][stable-6] redhat_subscription: require credentials only when needed (#6222) 2023-03-22 20:56:22 +01:00
test Fix more copyright lines, add more default copyright lines (#5095) 2022-08-08 14:24:58 +02:00