Beginning work on GCE.

This commit is contained in:
Luke Sneeringer
2014-07-18 12:08:52 -05:00
parent e44784651a
commit ca19ddb3d5
3 changed files with 39 additions and 6 deletions

View File

@@ -27,11 +27,12 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique):
''' '''
KIND_CHOICES = [ KIND_CHOICES = [
('ssh', _('Machine')), ('ssh', _('Machine')),
('scm', _('Source Control')), ('scm', _('Source Control')),
('aws', _('Amazon Web Services')), ('aws', _('Amazon Web Services')),
('rax', _('Rackspace')), ('rax', _('Rackspace')),
('vmware', _('VMWare')), ('vmware', _('VMWare')),
('gce', _('Google Compute Engine')),
] ]
PASSWORD_FIELDS = ('password', 'ssh_key_data', 'ssh_key_unlock', PASSWORD_FIELDS = ('password', 'ssh_key_data', 'ssh_key_unlock',

View File

@@ -869,6 +869,9 @@ class RunInventoryUpdate(BaseTask):
env['VMWARE_HOST'] = passwords.get('source_host', '') env['VMWARE_HOST'] = passwords.get('source_host', '')
env['VMWARE_USER'] = passwords.get('source_username', '') env['VMWARE_USER'] = passwords.get('source_username', '')
env['VMWARE_PASSWORD'] = passwords.get('source_password', '') env['VMWARE_PASSWORD'] = passwords.get('source_password', '')
elif inventory_update.source == 'gce':
pass
# env['GCE_USER']
elif inventory_update.source == 'file': elif inventory_update.source == 'file':
# FIXME: Parse source_env to dict, update env. # FIXME: Parse source_env to dict, update env.
@@ -902,7 +905,7 @@ class RunInventoryUpdate(BaseTask):
# These settings are "per-cloud-provider"; it's entirely possible that # These settings are "per-cloud-provider"; it's entirely possible that
# they will be different between cloud providers if a Tower user # they will be different between cloud providers if a Tower user
# actively uses more than one. # actively uses more than one.
if inventory_update.source in ('ec2', 'rax', 'vmware'): if inventory_update.source in ('ec2', 'rax', 'vmware', 'gce'):
# We need to reference the source's code frequently, assign it # We need to reference the source's code frequently, assign it
# to a shorter variable. :) # to a shorter variable. :)
src = inventory_update.source src = inventory_update.source

View File

@@ -389,7 +389,6 @@ EC2_EXCLUDE_EMPTY_GROUPS = True
# ------------ # ------------
# -- VMWare -- # -- VMWare --
# ------------ # ------------
VMWARE_REGION_NAMES = {}
VMWARE_REGIONS_BLACKLIST = [] VMWARE_REGIONS_BLACKLIST = []
# Inventory variable name/values for determining whether a host is # Inventory variable name/values for determining whether a host is
@@ -407,6 +406,36 @@ VMWARE_HOST_FILTER = r'^.+$'
VMWARE_EXCLUDE_EMPTY_GROUPS = True VMWARE_EXCLUDE_EMPTY_GROUPS = True
# ---------------------------
# -- Google Compute Engine --
# ---------------------------
# It's not possible to get zones in GCE without authenticating, so we
# provide a list here.
# Source: https://developers.google.com/compute/docs/zones
GCE_REGION_CHOICES = [
('us-central1-a', 'US Central (A)'),
('us-central1-b', 'US Central (B)'),
('us-central1-f', 'US Central (F)'),
('europe-west1-a', 'Europe West (A)'),
('europe-west1-b', 'Europe West (B)')
('asia-east1-a', 'Asia East (A)'),
('asia-east1-b', 'Asia East (B)'),
]
GCE_REGIONS_BLACKLIST = []
# Inventory variable name/value for determining whether a host is active
# in Google Compute Engine.
GCE_ENABLED_VAR = 'status'
GCE_ENABLED_VALUE = '<???>'
# Filter for allowed group and host names when importing inventory from
# Google Compute Engine.
GCE_GROUP_FILTER = r'^.+$'
GCE_HOST_FILTER = r'^.+$'
GCE_EXCLUDE_EMPTY_GROUPS = True
# --------------------- # ---------------------
# -- Activity Stream -- # -- Activity Stream --
# --------------------- # ---------------------