mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 21:46:00 -03:30
add ansible_want_ssh_host, rich_params and want_facts to be read from source vars
This commit is contained in:
committed by
Ryan Petrello
parent
b611164422
commit
374c17751f
@@ -2390,6 +2390,9 @@ class satellite6(PluginFileInjector):
|
|||||||
group_patterns = '[]'
|
group_patterns = '[]'
|
||||||
group_prefix = 'foreman_'
|
group_prefix = 'foreman_'
|
||||||
want_hostcollections = 'False'
|
want_hostcollections = 'False'
|
||||||
|
want_ansible_ssh_host = 'False'
|
||||||
|
rich_params = 'False'
|
||||||
|
want_facts = 'True'
|
||||||
foreman_opts = dict(inventory_update.source_vars_dict.items())
|
foreman_opts = dict(inventory_update.source_vars_dict.items())
|
||||||
foreman_opts.setdefault('ssl_verify', 'False')
|
foreman_opts.setdefault('ssl_verify', 'False')
|
||||||
for k, v in foreman_opts.items():
|
for k, v in foreman_opts.items():
|
||||||
@@ -2399,6 +2402,12 @@ class satellite6(PluginFileInjector):
|
|||||||
group_prefix = v
|
group_prefix = v
|
||||||
elif k == 'satellite6_want_hostcollections' and isinstance(v, bool):
|
elif k == 'satellite6_want_hostcollections' and isinstance(v, bool):
|
||||||
want_hostcollections = v
|
want_hostcollections = v
|
||||||
|
elif k == 'satellite6_want_ansible_ssh_host' and isinstance(v, bool):
|
||||||
|
want_ansible_ssh_host = v
|
||||||
|
elif k == 'satellite6_rich_params' and isinstance(v, bool):
|
||||||
|
rich_params = v
|
||||||
|
elif k == 'satellite6_want_facts' and isinstance(v, bool):
|
||||||
|
want_facts = v
|
||||||
else:
|
else:
|
||||||
cp.set(section, k, str(v))
|
cp.set(section, k, str(v))
|
||||||
|
|
||||||
@@ -2410,9 +2419,11 @@ class satellite6(PluginFileInjector):
|
|||||||
section = 'ansible'
|
section = 'ansible'
|
||||||
cp.add_section(section)
|
cp.add_section(section)
|
||||||
cp.set(section, 'group_patterns', group_patterns)
|
cp.set(section, 'group_patterns', group_patterns)
|
||||||
cp.set(section, 'want_facts', 'True')
|
cp.set(section, 'want_facts', str(want_facts))
|
||||||
cp.set(section, 'want_hostcollections', str(want_hostcollections))
|
cp.set(section, 'want_hostcollections', str(want_hostcollections))
|
||||||
cp.set(section, 'group_prefix', group_prefix)
|
cp.set(section, 'group_prefix', group_prefix)
|
||||||
|
cp.set(section, 'want_ansible_ssh_host', str(want_ansible_ssh_host))
|
||||||
|
cp.set(section, 'rich_params', str(rich_params))
|
||||||
|
|
||||||
section = 'cache'
|
section = 'cache'
|
||||||
cp.add_section(section)
|
cp.add_section(section)
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ group_patterns = foo_group_patterns
|
|||||||
want_facts = True
|
want_facts = True
|
||||||
want_hostcollections = True
|
want_hostcollections = True
|
||||||
group_prefix = foo_group_prefix
|
group_prefix = foo_group_prefix
|
||||||
|
want_ansible_ssh_host = True
|
||||||
|
rich_params = True
|
||||||
|
|
||||||
[cache]
|
[cache]
|
||||||
path = /tmp
|
path = /tmp
|
||||||
|
|||||||
@@ -60,7 +60,11 @@ INI_TEST_VARS = {
|
|||||||
'satellite6': {
|
'satellite6': {
|
||||||
'satellite6_group_patterns': 'foo_group_patterns',
|
'satellite6_group_patterns': 'foo_group_patterns',
|
||||||
'satellite6_group_prefix': 'foo_group_prefix',
|
'satellite6_group_prefix': 'foo_group_prefix',
|
||||||
'satellite6_want_hostcollections': True
|
'satellite6_want_hostcollections': True,
|
||||||
|
'satellite6_want_ansible_ssh_host': True,
|
||||||
|
'satellite6_rich_params': True,
|
||||||
|
'satellite6_want_facts': True
|
||||||
|
|
||||||
},
|
},
|
||||||
'cloudforms': {
|
'cloudforms': {
|
||||||
'version': '2.4',
|
'version': '2.4',
|
||||||
|
|||||||
@@ -2146,7 +2146,14 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
inventory_update.get_cloud_credential = get_cred
|
inventory_update.get_cloud_credential = get_cred
|
||||||
inventory_update.get_extra_credentials = mocker.Mock(return_value=[])
|
inventory_update.get_extra_credentials = mocker.Mock(return_value=[])
|
||||||
|
|
||||||
inventory_update.source_vars = '{"satellite6_group_patterns": "[a,b,c]", "satellite6_group_prefix": "hey_", "satellite6_want_hostcollections": True}'
|
inventory_update.source_vars = {
|
||||||
|
'satellite6_group_patterns': '[a,b,c]',
|
||||||
|
'satellite6_group_prefix': 'hey_',
|
||||||
|
'satellite6_want_hostcollections': True,
|
||||||
|
'satellite6_want_ansible_ssh_host': True,
|
||||||
|
'satellite6_rich_params': True,
|
||||||
|
'satellite6_want_facts': False
|
||||||
|
}
|
||||||
|
|
||||||
private_data_files = task.build_private_data_files(inventory_update, private_data_dir)
|
private_data_files = task.build_private_data_files(inventory_update, private_data_dir)
|
||||||
env = task.build_env(inventory_update, private_data_dir, False, private_data_files)
|
env = task.build_env(inventory_update, private_data_dir, False, private_data_files)
|
||||||
@@ -2159,6 +2166,9 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
assert config.get('ansible', 'group_patterns') == '[a,b,c]'
|
assert config.get('ansible', 'group_patterns') == '[a,b,c]'
|
||||||
assert config.get('ansible', 'group_prefix') == 'hey_'
|
assert config.get('ansible', 'group_prefix') == 'hey_'
|
||||||
assert config.get('ansible', 'want_hostcollections') == 'True'
|
assert config.get('ansible', 'want_hostcollections') == 'True'
|
||||||
|
assert config.get('ansible', 'want_ansible_ssh_host') == 'True'
|
||||||
|
assert config.get('ansible', 'rich_params') == 'True'
|
||||||
|
assert config.get('ansible', 'want_facts') == 'False'
|
||||||
|
|
||||||
def test_cloudforms_source(self, inventory_update, private_data_dir, mocker):
|
def test_cloudforms_source(self, inventory_update, private_data_dir, mocker):
|
||||||
task = tasks.RunInventoryUpdate()
|
task = tasks.RunInventoryUpdate()
|
||||||
|
|||||||
Reference in New Issue
Block a user