1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

redhat_subscription: Add server_prefix and server_port as supported arguments (#2779) (#2814)

* Add server_prefix and server_port as supported arguments for the redhat_subscription module.

* Adjust the argument sequence in the test case to be consistent with the original code in line 364 in redhat_subscription.py and add the changelog fragment.

* Grammatical changes such as adding full stops and using 'an HTTP' instead of 'a HTTP'.

* Commit the suggested changelog update.

Co-authored-by: Amin Vakil <info@aminvakil.com>

* Fix typo.

Co-authored-by: Amin Vakil <info@aminvakil.com>

Co-authored-by: Amin Vakil <info@aminvakil.com>
(cherry picked from commit 2f2f384b4e)

Co-authored-by: Tong He <68936428+unnecessary-username@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-06-16 09:39:52 +02:00 committed by GitHub
parent 151b482fe6
commit 59d7850900
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 3 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- redhat_subscription - add ``server_prefix`` and ``server_port`` parameters (https://github.com/ansible-collections/community.general/pull/2779).

View file

@ -32,7 +32,7 @@ options:
type: str
username:
description:
- access.redhat.com or Sat6 username
- access.redhat.com or Sat6 username
type: str
password:
description:
@ -46,6 +46,16 @@ options:
description:
- Enable or disable https server certificate verification when connecting to C(server_hostname)
type: str
server_prefix:
description:
- Specify the prefix when registering to the Red Hat Subscription Management or Sat6 server.
type: str
version_added: 3.3.0
server_port:
description:
- Specify the port when registering to the Red Hat Subscription Management or Sat6 server.
type: str
version_added: 3.3.0
rhsm_baseurl:
description:
- Specify CDN baseurl
@ -56,11 +66,11 @@ options:
type: str
server_proxy_hostname:
description:
- Specify a HTTP proxy hostname
- Specify an HTTP proxy hostname.
type: str
server_proxy_port:
description:
- Specify a HTTP proxy port
- Specify an HTTP proxy port.
type: str
server_proxy_user:
description:
@ -782,6 +792,8 @@ def main():
'password': {'no_log': True},
'server_hostname': {},
'server_insecure': {},
'server_prefix': {},
'server_port': {},
'rhsm_baseurl': {},
'rhsm_repo_ca_cert': {},
'auto_attach': {'aliases': ['autosubscribe'], 'type': 'bool'},
@ -827,6 +839,8 @@ def main():
password = module.params['password']
server_hostname = module.params['server_hostname']
server_insecure = module.params['server_insecure']
server_prefix = module.params['server_prefix']
server_port = module.params['server_port']
rhsm_baseurl = module.params['rhsm_baseurl']
rhsm_repo_ca_cert = module.params['rhsm_repo_ca_cert']
auto_attach = module.params['auto_attach']

View file

@ -258,6 +258,47 @@ TEST_CASES = [
'msg': "System successfully registered to 'None'."
}
],
# Test of registration with arguments that are not part of register options but needs to be configured
[
{
'state': 'present',
'username': 'admin',
'password': 'admin',
'org_id': 'admin',
'force_register': 'true',
'server_prefix': '/rhsm',
'server_port': '443'
},
{
'id': 'test_arguments_not_in_register_options',
'run_command.calls': [
(
['/testbin/subscription-manager', 'identity'],
{'check_rc': False},
(0, 'This system already registered.', '')
),
(
['/testbin/subscription-manager', 'config',
'--server.port=443',
'--server.prefix=/rhsm'
],
{'check_rc': True},
(0, '', '')
),
(
['/testbin/subscription-manager', 'register',
'--force',
'--org', 'admin',
'--username', 'admin',
'--password', 'admin'],
{'check_rc': True, 'expand_user_and_vars': False},
(0, '', '')
)
],
'changed': True,
'msg': "System successfully registered to 'None'."
}
],
# Test of registration using username, password and proxy options
[
{