add API support for Satellite 6 inventory (#1098)

This commit is contained in:
Wayne Witzel III
2016-04-05 11:57:23 -04:00
parent 2d9e34162c
commit 051dfd4b0e
7 changed files with 361 additions and 18 deletions

View File

@@ -1217,6 +1217,28 @@ class RunInventoryUpdate(BaseTask):
for k,v in vmware_opts.items():
cp.set(section, k, unicode(v))
elif inventory_update.source == 'foreman':
section = 'foreman'
cp.add_section(section)
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))
credential = inventory_update.credential
if credential:
cp.set(section, 'url', credential.host)
cp.set(section, 'user', credential.username)
cp.set(section, 'password', decrypt_field(credential, 'password'))
section = 'ansible'
cp.set(section, 'group_patterns', '["{app}-{tier}-{color}", "{app}-{color}", "{app}", "{tier}"]')
section = 'cache'
cp.set(section, 'path', '/tmp')
cp.set(section, 'max_age', '0')
# Return INI content.
if cp.sections():
f = cStringIO.StringIO()
@@ -1297,6 +1319,8 @@ class RunInventoryUpdate(BaseTask):
env['GCE_ZONE'] = inventory_update.source_regions
elif inventory_update.source == 'openstack':
env['OS_CLIENT_CONFIG_FILE'] = cloud_credential
elif inventory_update.source == 'foreman':
env['FOREMAN_INI_PATH'] = cloud_credential
elif inventory_update.source == 'file':
# FIXME: Parse source_env to dict, update env.
pass