Make sure required profile configurations passed in a map file work

This commit is contained in:
rallytime 2016-02-11 10:13:37 -07:00
parent 94fa76831f
commit 337592ec56
23 changed files with 53 additions and 24 deletions

View file

@ -583,7 +583,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'aliyun',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -238,7 +238,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'cloudstack',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -273,7 +273,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'digital_ocean',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -2295,7 +2295,8 @@ def create(vm_=None, call=None):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'ec2',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -2025,7 +2025,8 @@ def create(vm_=None, call=None):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'gce',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -86,7 +86,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'gogrid',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -244,7 +244,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'joyent',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -324,7 +324,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'aws',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -342,7 +342,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'linode',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -411,7 +411,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'azure',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -649,7 +649,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'nova',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -301,7 +301,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'opennebula',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -556,7 +556,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'openstack',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -273,7 +273,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'parallels',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -503,7 +503,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'proxmox',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -660,7 +660,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'qingcloud',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -195,7 +195,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'rackspace',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -208,7 +208,8 @@ def create(server_):
# Check for required profile parameters before sending any API calls.
if server_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'scaleway',
server_['profile']) is False:
server_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -246,7 +246,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'softlayer',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -217,7 +217,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'softlayer_hw',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -2006,7 +2006,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if config.is_profile_configured(__opts__,
__active_provider_name__ or 'vmware',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -245,7 +245,8 @@ def create(vm_):
# Check for required profile parameters before sending any API calls.
if vm_['profile'] and config.is_profile_configured(__opts__,
__active_provider_name__ or 'vsphere',
vm_['profile']) is False:
vm_['profile'],
vm_=vm_) is False:
return False
except AttributeError:
pass

View file

@ -2602,7 +2602,7 @@ def is_provider_configured(opts, provider, required_keys=()):
return False
def is_profile_configured(opts, provider, profile_name):
def is_profile_configured(opts, provider, profile_name, vm_=None):
'''
Check if the requested profile contains the minimum required parameters for
a profile.
@ -2647,10 +2647,17 @@ def is_profile_configured(opts, provider, profile_name):
# Check if image and/or size are supplied in the provider config. If either
# one is present, remove it from the required_keys list.
for item in required_keys:
for item in list(required_keys):
if item in provider_key:
required_keys.remove(item)
# If a vm_ dict was passed in, use that information to get any other configs
# that we might have missed thus far, such as a option provided in a map file.
if vm_:
for item in list(required_keys):
if item in vm_:
required_keys.remove(item)
# Check for remaining required parameters in the profile config.
for item in required_keys:
if profile_key.get(item, None) is None: