mirror of
https://github.com/ansible/awx.git
synced 2026-07-29 08:59:55 -02:30
add API support for CloudForms inventory (#1099)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Copyright (c) 2015 Ansible, Inc.
|
||||
# All Rights Reserved.
|
||||
|
||||
CLOUD_PROVIDERS = ('azure', 'ec2', 'gce', 'rax', 'vmware', 'openstack', 'foreman')
|
||||
CLOUD_PROVIDERS = ('azure', 'ec2', 'gce', 'rax', 'vmware', 'openstack', 'foreman', 'cloudforms')
|
||||
SCHEDULEABLE_PROVIDERS = CLOUD_PROVIDERS + ('custom',)
|
||||
|
||||
@@ -61,7 +61,7 @@ PERMISSION_TYPE_CHOICES = [
|
||||
(PERM_JOBTEMPLATE_CREATE, _('Create a Job Template')),
|
||||
]
|
||||
|
||||
CLOUD_INVENTORY_SOURCES = ['ec2', 'rax', 'vmware', 'gce', 'azure', 'openstack', 'custom', 'foreman']
|
||||
CLOUD_INVENTORY_SOURCES = ['ec2', 'rax', 'vmware', 'gce', 'azure', 'openstack', 'custom', 'foreman', 'cloudforms']
|
||||
|
||||
VERBOSITY_CHOICES = [
|
||||
(0, '0 (Normal)'),
|
||||
|
||||
@@ -38,6 +38,7 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
|
||||
('rax', _('Rackspace')),
|
||||
('vmware', _('VMware vCenter')),
|
||||
('foreman', _('Satellite 6')),
|
||||
('cloudforms', _('CloudForms')),
|
||||
('gce', _('Google Compute Engine')),
|
||||
('azure', _('Microsoft Azure')),
|
||||
('openstack', _('OpenStack')),
|
||||
|
||||
@@ -733,6 +733,7 @@ class InventorySourceOptions(BaseModel):
|
||||
('azure', _('Microsoft Azure')),
|
||||
('vmware', _('VMware vCenter')),
|
||||
('foreman', _('Satellite 6')),
|
||||
('cloudforms', _('CloudForms')),
|
||||
('openstack', _('OpenStack')),
|
||||
('custom', _('Custom Script')),
|
||||
]
|
||||
|
||||
@@ -1239,6 +1239,16 @@ class RunInventoryUpdate(BaseTask):
|
||||
cp.set(section, 'path', '/tmp')
|
||||
cp.set(section, 'max_age', '0')
|
||||
|
||||
elif inventory_update.source == 'cloudforms':
|
||||
section = 'cloudforms'
|
||||
cp.add_section(section)
|
||||
|
||||
credential = inventory_update.credential
|
||||
if credential:
|
||||
cp.set(section, 'hostname', credential.host)
|
||||
cp.set(section, 'username', credential.username)
|
||||
cp.set(section, 'password', decrypt_field(credential, 'password'))
|
||||
|
||||
# Return INI content.
|
||||
if cp.sections():
|
||||
f = cStringIO.StringIO()
|
||||
@@ -1321,6 +1331,8 @@ class RunInventoryUpdate(BaseTask):
|
||||
env['OS_CLIENT_CONFIG_FILE'] = cloud_credential
|
||||
elif inventory_update.source == 'foreman':
|
||||
env['FOREMAN_INI_PATH'] = cloud_credential
|
||||
elif inventory_update.source == 'cloudforms':
|
||||
env['CLOUDFORMS_INI_PATH'] = cloud_credential
|
||||
elif inventory_update.source == 'file':
|
||||
# FIXME: Parse source_env to dict, update env.
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user