Working GCE inventory sync.

This commit is contained in:
Luke Sneeringer
2014-07-23 11:10:36 -05:00
parent 5df7833038
commit a1059dabae
6 changed files with 6 additions and 5 deletions

View File

@@ -1227,4 +1227,4 @@ class Command(NoArgsCommand):
if exc and isinstance(exc, CommandError): if exc and isinstance(exc, CommandError):
sys.exit(1) sys.exit(1)
elif exc: elif exc:
raise exc raise

View File

@@ -60,7 +60,7 @@ PERMISSION_TYPE_CHOICES = [
(PERM_INVENTORY_CHECK, _('Deploy To Inventory (Dry Run)')), (PERM_INVENTORY_CHECK, _('Deploy To Inventory (Dry Run)')),
] ]
CLOUD_INVENTORY_SOURCES = ['ec2', 'rax'] CLOUD_INVENTORY_SOURCES = ['ec2', 'rax', 'vmware', 'gce', 'azure']
class VarsDictProperty(object): class VarsDictProperty(object):

View File

@@ -840,8 +840,8 @@ class RunInventoryUpdate(BaseTask):
for subkey in ('username', 'host', 'project'): for subkey in ('username', 'host', 'project'):
passwords['source_%s' % subkey] = getattr(credential, subkey) passwords['source_%s' % subkey] = getattr(credential, subkey)
for passkey in ('password', 'ssh_key_data'): for passkey in ('password', 'ssh_key_data'):
k = 'source_%s' % subkey k = 'source_%s' % passkey
passwords[k] = decrypt_field(credential, subkey) passwords[k] = decrypt_field(credential, passkey)
return passwords return passwords
def build_env(self, inventory_update, **kwargs): def build_env(self, inventory_update, **kwargs):
@@ -977,7 +977,7 @@ class RunInventoryUpdate(BaseTask):
# We might have a flag for an instance ID variable; if we do, # We might have a flag for an instance ID variable; if we do,
# add it to the shell arguments. # add it to the shell arguments.
if getattr(settings, '%s_INSTANCE_ID_VAR' % src.upper()): if getattr(settings, '%s_INSTANCE_ID_VAR' % src.upper(), False):
args.extend([ args.extend([
'--instance-id-var', '--instance-id-var',
getattr(settings, '%s_INSTANCE_ID_VAR' % src.upper()), getattr(settings, '%s_INSTANCE_ID_VAR' % src.upper()),

0
awx/plugins/inventory/gce.py Normal file → Executable file
View File

0
awx/plugins/inventory/vmware.py Normal file → Executable file
View File

View File

@@ -434,6 +434,7 @@ GCE_ENABLED_VALUE = 'running'
GCE_GROUP_FILTER = r'^.+$' GCE_GROUP_FILTER = r'^.+$'
GCE_HOST_FILTER = r'^.+$' GCE_HOST_FILTER = r'^.+$'
GCE_EXCLUDE_EMPTY_GROUPS = True GCE_EXCLUDE_EMPTY_GROUPS = True
GCE_INSTANCE_ID_VAR = None
# --------------------- # ---------------------