summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-09-14 13:13:29 -0700
committerelijah <elijah@riseup.net>2016-09-14 13:13:29 -0700
commit836876b4b0763e01526c9aa9c1fc34e1d82416aa (patch)
treee42a4e0a2fcdaf1b21f1599d585cc9d2696dec62 /lib
parent3262fcfa9188bb45d40ea2234af9ce8119100570 (diff)
[bugfix] leap vm: make the default instance type 't2.nano'
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/cloud/cloud.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/leap_cli/cloud/cloud.rb b/lib/leap_cli/cloud/cloud.rb
index 231274a5..753041f6 100644
--- a/lib/leap_cli/cloud/cloud.rb
+++ b/lib/leap_cli/cloud/cloud.rb
@@ -34,6 +34,9 @@
module LeapCli
class Cloud
+ DEFAULT_INSTANCE_OPTIONS = {
+ "InstanceType" => "t2.nano"
+ }
LEAP_SG_NAME = 'leap_default'
LEAP_SG_DESC = 'Default security group for LEAP nodes'
@@ -50,7 +53,7 @@ module LeapCli
@name = name
@conf = conf
@compute = nil
- @options = nil
+ @options = DEFAULT_INSTANCE_OPTIONS
@image = nil
raise ArgumentError, 'name missing' unless @name
@@ -62,12 +65,21 @@ module LeapCli
credentials[:provider] = @conf["vendor"]
@compute = Fog::Compute.new(credentials)
- @options = @conf['default_options'] || {}
- @image = @conf['default_image'] || Cloud.aws_image(credentials[:region])
+ if @conf['default_options']
+ @options = @options.merge(@conf['default_options'])
+ end
+ @image = @conf['default_image'] || Cloud.aws_image(credentials[:region])
if @node
- @options = node.vm.options if node['vm.options']
+ @options = @options.merge(node.vm.options) if node['vm.options']
@image = node.vm.image if node['vm.image']
end
+
+ unless @options['InstanceType']
+ raise ArgumentError, 'VM instance type is required. See https://leap.se/virtual-machines for more information.'
+ end
+ unless @image
+ raise ArgumentError, 'VM image is required. See https://leap.se/virtual-machines for more information.'
+ end
end
#