1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Move Satellite 6 .ini configurations from env variables to source_vars

This commit is contained in:
Aaron Tan 2017-07-26 12:12:43 -04:00
parent 6856c77a8e
commit 323d7757dd
2 changed files with 14 additions and 5 deletions

View File

@ -1611,8 +1611,7 @@ class RunInventoryUpdate(BaseTask):
ec2_opts.setdefault('route53', 'False')
ec2_opts.setdefault('all_instances', 'True')
ec2_opts.setdefault('all_rds_instances', 'False')
# TODO: Include this option when boto3 support comes.
#ec2_opts.setdefault('include_rds_clusters', 'False')
ec2_opts.setdefault('include_rds_clusters', 'False')
ec2_opts.setdefault('rds', 'False')
ec2_opts.setdefault('nested_groups', 'True')
ec2_opts.setdefault('elasticache', 'False')
@ -1654,10 +1653,17 @@ class RunInventoryUpdate(BaseTask):
section = 'foreman'
cp.add_section(section)
group_patterns = '[]'
group_prefix = 'foreman_'
foreman_opts = dict(inventory_update.source_vars_dict.items())
foreman_opts.setdefault('ssl_verify', 'False')
for k, v in foreman_opts.items():
cp.set(section, k, unicode(v))
if k == 'satellite6_group_patterns' and isinstance(v, basestring):
group_patterns = v
elif k == 'satellite6_group_prefix' and isinstance(v, basestring):
group_prefix = v
else:
cp.set(section, k, unicode(v))
credential = inventory_update.credential
if credential:
@ -1667,9 +1673,9 @@ class RunInventoryUpdate(BaseTask):
section = 'ansible'
cp.add_section(section)
cp.set(section, 'group_patterns', os.environ.get('SATELLITE6_GROUP_PATTERNS', []))
cp.set(section, 'group_patterns', group_patterns)
cp.set(section, 'want_facts', True)
cp.set(section, 'group_prefix', os.environ.get('SATELLITE6_GROUP_PREFIX', 'foreman_'))
cp.set(section, 'group_prefix', group_prefix)
section = 'cache'
cp.add_section(section)

View File

@ -1348,6 +1348,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
self.instance.credential.inputs['password'] = encrypt_field(
self.instance.credential, 'password'
)
self.instance.source_vars = '{"satellite6_group_patterns": "[a,b,c]", "satellite6_group_prefix": "hey_"}'
def run_pexpect_side_effect(*args, **kwargs):
args, cwd, env, stdout = args
@ -1356,6 +1357,8 @@ class TestInventoryUpdateCredentials(TestJobExecution):
assert config.get('foreman', 'url') == 'https://example.org'
assert config.get('foreman', 'user') == 'bob'
assert config.get('foreman', 'password') == 'secret'
assert config.get('ansible', 'group_patterns') == '[a,b,c]'
assert config.get('ansible', 'group_prefix') == 'hey_'
return ['successful', 0]
self.run_pexpect.side_effect = run_pexpect_side_effect