From 63dfd1a23ae6d8b50a4cf2efa8ee481d6a29adc8 Mon Sep 17 00:00:00 2001 From: Christopher Dickey Date: Thu, 28 Jan 2016 15:27:51 -0800 Subject: [PATCH] Added safer .get method to vm_ 'networks' dictionary --- salt/cloud/clouds/joyent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/salt/cloud/clouds/joyent.py b/salt/cloud/clouds/joyent.py index b1406d5278..847b3f3157 100644 --- a/salt/cloud/clouds/joyent.py +++ b/salt/cloud/clouds/joyent.py @@ -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)