mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
Merge pull request #7360 from jladdjr/foreman_backwards_compat_for_ssl_verify
[foreman] add backwards support for ssl_verify in foreman plugin Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
9e118b8a0c
@ -2596,6 +2596,7 @@ class satellite6(PluginFileInjector):
|
||||
|
||||
def inventory_as_dict(self, inventory_update, private_data_dir):
|
||||
ret = super(satellite6, self).inventory_as_dict(inventory_update, private_data_dir)
|
||||
ret['validate_certs'] = False
|
||||
|
||||
group_patterns = '[]'
|
||||
group_prefix = 'foreman_'
|
||||
@ -2615,6 +2616,10 @@ class satellite6(PluginFileInjector):
|
||||
want_ansible_ssh_host = v
|
||||
elif k == 'satellite6_want_facts' and isinstance(v, bool):
|
||||
want_facts = v
|
||||
# add backwards support for ssl_verify
|
||||
# plugin uses new option, validate_certs, instead
|
||||
elif k == 'ssl_verify' and isinstance(v, bool):
|
||||
ret['validate_certs'] = v
|
||||
else:
|
||||
ret[k] = str(v)
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ keyed_groups:
|
||||
separator: ''
|
||||
legacy_hostvars: true
|
||||
plugin: theforeman.foreman.foreman
|
||||
validate_certs: false
|
||||
want_facts: true
|
||||
want_hostcollections: true
|
||||
want_params: true
|
||||
|
||||
@ -72,6 +72,23 @@ def test_invalid_kind_clean_insights_credential():
|
||||
assert json.dumps(str(e.value)) == json.dumps(str([u'Assignment not allowed for Smart Inventory']))
|
||||
|
||||
|
||||
@pytest.mark.parametrize('source_vars,validate_certs', [
|
||||
({'ssl_verify': True}, True),
|
||||
({'ssl_verify': False}, False),
|
||||
({'validate_certs': True}, True),
|
||||
({'validate_certs': False}, False)])
|
||||
def test_satellite_plugin_backwards_support_for_ssl_verify(source_vars, validate_certs):
|
||||
injector = InventorySource.injectors['satellite6']('2.9')
|
||||
inv_src = InventorySource(
|
||||
name='satellite source', source='satellite6',
|
||||
source_vars=source_vars
|
||||
)
|
||||
|
||||
ret = injector.inventory_as_dict(inv_src, '/tmp/foo')
|
||||
assert 'validate_certs' in ret
|
||||
assert ret['validate_certs'] in (validate_certs, str(validate_certs))
|
||||
|
||||
|
||||
class TestControlledBySCM():
|
||||
def test_clean_source_path_valid(self):
|
||||
inv_src = InventorySource(source_path='/not_real/',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user