mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 10:41:05 -03:30
Merge pull request #2055 from wenottingham/sattests
add want_hostcollections for sat6 source vars (with tests)
This commit is contained in:
@@ -1850,6 +1850,7 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
|
|
||||||
group_patterns = '[]'
|
group_patterns = '[]'
|
||||||
group_prefix = 'foreman_'
|
group_prefix = 'foreman_'
|
||||||
|
want_hostcollections = 'False'
|
||||||
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():
|
||||||
@@ -1857,6 +1858,8 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
group_patterns = v
|
group_patterns = v
|
||||||
elif k == 'satellite6_group_prefix' and isinstance(v, basestring):
|
elif k == 'satellite6_group_prefix' and isinstance(v, basestring):
|
||||||
group_prefix = v
|
group_prefix = v
|
||||||
|
elif k == 'satellite6_want_hostcollections' and isinstance(v, bool):
|
||||||
|
want_hostcollections = v
|
||||||
else:
|
else:
|
||||||
cp.set(section, k, six.text_type(v))
|
cp.set(section, k, six.text_type(v))
|
||||||
|
|
||||||
@@ -1869,6 +1872,7 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
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', True)
|
||||||
|
cp.set(section, 'want_hostcollections', want_hostcollections)
|
||||||
cp.set(section, 'group_prefix', group_prefix)
|
cp.set(section, 'group_prefix', group_prefix)
|
||||||
|
|
||||||
section = 'cache'
|
section = 'cache'
|
||||||
|
|||||||
@@ -2055,7 +2055,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
return cred
|
return cred
|
||||||
self.instance.get_cloud_credential = get_cred
|
self.instance.get_cloud_credential = get_cred
|
||||||
|
|
||||||
self.instance.source_vars = '{"satellite6_group_patterns": "[a,b,c]", "satellite6_group_prefix": "hey_"}'
|
self.instance.source_vars = '{"satellite6_group_patterns": "[a,b,c]", "satellite6_group_prefix": "hey_", "satellite6_want_hostcollections": True}'
|
||||||
|
|
||||||
def run_pexpect_side_effect(*args, **kwargs):
|
def run_pexpect_side_effect(*args, **kwargs):
|
||||||
args, cwd, env, stdout = args
|
args, cwd, env, stdout = args
|
||||||
@@ -2066,6 +2066,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
assert config.get('foreman', 'password') == 'secret'
|
assert config.get('foreman', 'password') == 'secret'
|
||||||
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'
|
||||||
return ['successful', 0]
|
return ['successful', 0]
|
||||||
|
|
||||||
self.run_pexpect.side_effect = run_pexpect_side_effect
|
self.run_pexpect.side_effect = run_pexpect_side_effect
|
||||||
|
|||||||
Reference in New Issue
Block a user