From a1059dabaed598e8dec17d7e716126511cd0af7d Mon Sep 17 00:00:00 2001 From: Luke Sneeringer Date: Wed, 23 Jul 2014 11:10:36 -0500 Subject: [PATCH] Working GCE inventory sync. --- awx/main/management/commands/inventory_import.py | 2 +- awx/main/models/base.py | 2 +- awx/main/tasks.py | 6 +++--- awx/plugins/inventory/gce.py | 0 awx/plugins/inventory/vmware.py | 0 awx/settings/defaults.py | 1 + 6 files changed, 6 insertions(+), 5 deletions(-) mode change 100644 => 100755 awx/plugins/inventory/gce.py mode change 100644 => 100755 awx/plugins/inventory/vmware.py diff --git a/awx/main/management/commands/inventory_import.py b/awx/main/management/commands/inventory_import.py index 3b9146df7c..3c052facc7 100644 --- a/awx/main/management/commands/inventory_import.py +++ b/awx/main/management/commands/inventory_import.py @@ -1227,4 +1227,4 @@ class Command(NoArgsCommand): if exc and isinstance(exc, CommandError): sys.exit(1) elif exc: - raise exc + raise diff --git a/awx/main/models/base.py b/awx/main/models/base.py index f888fd222e..87de8c7ce5 100644 --- a/awx/main/models/base.py +++ b/awx/main/models/base.py @@ -60,7 +60,7 @@ PERMISSION_TYPE_CHOICES = [ (PERM_INVENTORY_CHECK, _('Deploy To Inventory (Dry Run)')), ] -CLOUD_INVENTORY_SOURCES = ['ec2', 'rax'] +CLOUD_INVENTORY_SOURCES = ['ec2', 'rax', 'vmware', 'gce', 'azure'] class VarsDictProperty(object): diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 2088483da9..8ec296a06d 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -840,8 +840,8 @@ class RunInventoryUpdate(BaseTask): for subkey in ('username', 'host', 'project'): passwords['source_%s' % subkey] = getattr(credential, subkey) for passkey in ('password', 'ssh_key_data'): - k = 'source_%s' % subkey - passwords[k] = decrypt_field(credential, subkey) + k = 'source_%s' % passkey + passwords[k] = decrypt_field(credential, passkey) return passwords 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, # 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([ '--instance-id-var', getattr(settings, '%s_INSTANCE_ID_VAR' % src.upper()), diff --git a/awx/plugins/inventory/gce.py b/awx/plugins/inventory/gce.py old mode 100644 new mode 100755 diff --git a/awx/plugins/inventory/vmware.py b/awx/plugins/inventory/vmware.py old mode 100644 new mode 100755 diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index c89d53a7de..5ac4a99c32 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -434,6 +434,7 @@ GCE_ENABLED_VALUE = 'running' GCE_GROUP_FILTER = r'^.+$' GCE_HOST_FILTER = r'^.+$' GCE_EXCLUDE_EMPTY_GROUPS = True +GCE_INSTANCE_ID_VAR = None # ---------------------