Added safer .get method to vm_ 'networks' dictionary

This commit is contained in:
Christopher Dickey 2016-01-28 15:27:51 -08:00
parent feab016501
commit 63dfd1a23a

View File

@ -107,6 +107,8 @@ VALID_RESPONSE_CODES = [
http_client.NO_CONTENT
]
DEFAULT_NETWORKS = ['Joyent-SDC-Public']
# Only load in this module if the Joyent configurations are in place
def __virtual__():
@ -281,7 +283,7 @@ def create(vm_):
salt.utils.cloud.check_name(vm_['name'], 'a-zA-Z0-9-.')
kwargs = {
'name': vm_['name'],
'networks': vm_['networks'],
'networks': vm_.get('networks', DEFAULT_NETWORKS),
'image': get_image(vm_),
'size': get_size(vm_),
'location': vm_.get('location', DEFAULT_LOCATION)