mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
Merge pull request #66 from jangsutsr/3467_move_satellite_ini_config_from_env_to_source_var
Move Satellite 6 .ini configurations from env variables to source_vars
This commit is contained in:
@@ -1633,8 +1633,7 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
ec2_opts.setdefault('route53', 'False')
|
ec2_opts.setdefault('route53', 'False')
|
||||||
ec2_opts.setdefault('all_instances', 'True')
|
ec2_opts.setdefault('all_instances', 'True')
|
||||||
ec2_opts.setdefault('all_rds_instances', 'False')
|
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('rds', 'False')
|
||||||
ec2_opts.setdefault('nested_groups', 'True')
|
ec2_opts.setdefault('nested_groups', 'True')
|
||||||
ec2_opts.setdefault('elasticache', 'False')
|
ec2_opts.setdefault('elasticache', 'False')
|
||||||
@@ -1676,10 +1675,17 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
section = 'foreman'
|
section = 'foreman'
|
||||||
cp.add_section(section)
|
cp.add_section(section)
|
||||||
|
|
||||||
|
group_patterns = '[]'
|
||||||
|
group_prefix = 'foreman_'
|
||||||
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():
|
||||||
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
|
credential = inventory_update.credential
|
||||||
if credential:
|
if credential:
|
||||||
@@ -1689,9 +1695,9 @@ class RunInventoryUpdate(BaseTask):
|
|||||||
|
|
||||||
section = 'ansible'
|
section = 'ansible'
|
||||||
cp.add_section(section)
|
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, 'want_facts', True)
|
||||||
cp.set(section, 'group_prefix', os.environ.get('SATELLITE6_GROUP_PREFIX', 'foreman_'))
|
cp.set(section, 'group_prefix', group_prefix)
|
||||||
|
|
||||||
section = 'cache'
|
section = 'cache'
|
||||||
cp.add_section(section)
|
cp.add_section(section)
|
||||||
|
|||||||
@@ -1348,6 +1348,7 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
self.instance.credential.inputs['password'] = encrypt_field(
|
self.instance.credential.inputs['password'] = encrypt_field(
|
||||||
self.instance.credential, 'password'
|
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):
|
def run_pexpect_side_effect(*args, **kwargs):
|
||||||
args, cwd, env, stdout = args
|
args, cwd, env, stdout = args
|
||||||
@@ -1356,6 +1357,8 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
assert config.get('foreman', 'url') == 'https://example.org'
|
assert config.get('foreman', 'url') == 'https://example.org'
|
||||||
assert config.get('foreman', 'user') == 'bob'
|
assert config.get('foreman', 'user') == 'bob'
|
||||||
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_prefix') == 'hey_'
|
||||||
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