mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
Merge pull request #2451 from wenottingham/six-PRs-and-a-movie
Merge assorted PRs from the AWX community
This commit is contained in:
@@ -1889,6 +1889,7 @@ class RunInventoryUpdate(BaseTask):
|
||||
|
||||
group_patterns = '[]'
|
||||
group_prefix = 'foreman_'
|
||||
want_hostcollections = 'False'
|
||||
foreman_opts = dict(inventory_update.source_vars_dict.items())
|
||||
foreman_opts.setdefault('ssl_verify', 'False')
|
||||
for k, v in foreman_opts.items():
|
||||
@@ -1896,6 +1897,8 @@ class RunInventoryUpdate(BaseTask):
|
||||
group_patterns = v
|
||||
elif k == 'satellite6_group_prefix' and isinstance(v, basestring):
|
||||
group_prefix = v
|
||||
elif k == 'satellite6_want_hostcollections' and isinstance(v, bool):
|
||||
want_hostcollections = v
|
||||
else:
|
||||
cp.set(section, k, six.text_type(v))
|
||||
|
||||
@@ -1908,6 +1911,7 @@ class RunInventoryUpdate(BaseTask):
|
||||
cp.add_section(section)
|
||||
cp.set(section, 'group_patterns', group_patterns)
|
||||
cp.set(section, 'want_facts', True)
|
||||
cp.set(section, 'want_hostcollections', want_hostcollections)
|
||||
cp.set(section, 'group_prefix', group_prefix)
|
||||
|
||||
section = 'cache'
|
||||
@@ -1946,12 +1950,17 @@ class RunInventoryUpdate(BaseTask):
|
||||
cp.set(section, 'group_by_resource_group', 'yes')
|
||||
cp.set(section, 'group_by_location', 'yes')
|
||||
cp.set(section, 'group_by_tag', 'yes')
|
||||
|
||||
if inventory_update.source_regions and 'all' not in inventory_update.source_regions:
|
||||
cp.set(
|
||||
section, 'locations',
|
||||
','.join([x.strip() for x in inventory_update.source_regions.split(',')])
|
||||
)
|
||||
|
||||
azure_rm_opts = dict(inventory_update.source_vars_dict.items())
|
||||
for k,v in azure_rm_opts.items():
|
||||
cp.set(section, k, six.text_type(v))
|
||||
|
||||
# Return INI content.
|
||||
if cp.sections():
|
||||
f = cStringIO.StringIO()
|
||||
|
||||
@@ -1890,6 +1890,10 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
)
|
||||
return cred
|
||||
self.instance.get_cloud_credential = get_cred
|
||||
self.instance.source_vars = {
|
||||
'include_powerstate': 'yes',
|
||||
'group_by_resource_group': 'no'
|
||||
}
|
||||
|
||||
def run_pexpect_side_effect(*args, **kwargs):
|
||||
args, cwd, env, stdout = args
|
||||
@@ -1902,8 +1906,9 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read(env['AZURE_INI_PATH'])
|
||||
assert config.get('azure', 'include_powerstate') == 'yes'
|
||||
assert config.get('azure', 'group_by_resource_group') == 'yes'
|
||||
assert config.get('azure', 'group_by_resource_group') == 'no'
|
||||
assert config.get('azure', 'group_by_location') == 'yes'
|
||||
assert 'group_by_security_group' not in config.items('azure')
|
||||
assert config.get('azure', 'group_by_tag') == 'yes'
|
||||
assert config.get('azure', 'locations') == 'north,south,east,west'
|
||||
return ['successful', 0]
|
||||
@@ -1930,6 +1935,11 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
)
|
||||
return cred
|
||||
self.instance.get_cloud_credential = get_cred
|
||||
self.instance.source_vars = {
|
||||
'include_powerstate': 'yes',
|
||||
'group_by_resource_group': 'no',
|
||||
'group_by_security_group': 'no'
|
||||
}
|
||||
|
||||
def run_pexpect_side_effect(*args, **kwargs):
|
||||
args, cwd, env, stdout = args
|
||||
@@ -1941,8 +1951,9 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
config = ConfigParser.ConfigParser()
|
||||
config.read(env['AZURE_INI_PATH'])
|
||||
assert config.get('azure', 'include_powerstate') == 'yes'
|
||||
assert config.get('azure', 'group_by_resource_group') == 'yes'
|
||||
assert config.get('azure', 'group_by_resource_group') == 'no'
|
||||
assert config.get('azure', 'group_by_location') == 'yes'
|
||||
assert config.get('azure', 'group_by_security_group') == 'no'
|
||||
assert config.get('azure', 'group_by_tag') == 'yes'
|
||||
assert 'locations' not in config.items('azure')
|
||||
return ['successful', 0]
|
||||
@@ -2055,7 +2066,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
return 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):
|
||||
args, cwd, env, stdout = args
|
||||
@@ -2066,6 +2077,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
||||
assert config.get('foreman', 'password') == 'secret'
|
||||
assert config.get('ansible', 'group_patterns') == '[a,b,c]'
|
||||
assert config.get('ansible', 'group_prefix') == 'hey_'
|
||||
assert config.get('ansible', 'want_hostcollections') == 'True'
|
||||
return ['successful', 0]
|
||||
|
||||
self.run_pexpect.side_effect = run_pexpect_side_effect
|
||||
|
||||
Reference in New Issue
Block a user