Class: VagrantPlugins::SimpleCloud::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::SimpleCloud::Config
- Defined in:
- lib/vagrant-simplecloud/config.rb
Instance Attribute Summary collapse
-
#backups_enabled ⇒ Object
Returns the value of attribute backups_enabled.
-
#ca_path ⇒ Object
Returns the value of attribute ca_path.
-
#image ⇒ Object
Returns the value of attribute image.
-
#ipv6 ⇒ Object
Returns the value of attribute ipv6.
-
#private_networking ⇒ Object
Returns the value of attribute private_networking.
-
#region ⇒ Object
Returns the value of attribute region.
-
#setup ⇒ Object
(also: #setup?)
Returns the value of attribute setup.
-
#size ⇒ Object
Returns the value of attribute size.
-
#ssh_key_name ⇒ Object
Returns the value of attribute ssh_key_name.
-
#token ⇒ Object
Returns the value of attribute token.
-
#user_data ⇒ Object
Returns the value of attribute user_data.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-simplecloud/config.rb', line 18 def initialize @token = UNSET_VALUE @image = UNSET_VALUE @region = UNSET_VALUE @size = UNSET_VALUE @private_networking = UNSET_VALUE @ipv6 = UNSET_VALUE @backups_enable = UNSET_VALUE @ca_path = UNSET_VALUE @ssh_key_name = UNSET_VALUE @setup = UNSET_VALUE @user_data = UNSET_VALUE end |
Instance Attribute Details
#backups_enabled ⇒ Object
Returns the value of attribute backups_enabled.
10 11 12 |
# File 'lib/vagrant-simplecloud/config.rb', line 10 def backups_enabled @backups_enabled end |
#ca_path ⇒ Object
Returns the value of attribute ca_path.
11 12 13 |
# File 'lib/vagrant-simplecloud/config.rb', line 11 def ca_path @ca_path end |
#image ⇒ Object
Returns the value of attribute image.
5 6 7 |
# File 'lib/vagrant-simplecloud/config.rb', line 5 def image @image end |
#ipv6 ⇒ Object
Returns the value of attribute ipv6.
9 10 11 |
# File 'lib/vagrant-simplecloud/config.rb', line 9 def ipv6 @ipv6 end |
#private_networking ⇒ Object
Returns the value of attribute private_networking.
8 9 10 |
# File 'lib/vagrant-simplecloud/config.rb', line 8 def private_networking @private_networking end |
#region ⇒ Object
Returns the value of attribute region.
6 7 8 |
# File 'lib/vagrant-simplecloud/config.rb', line 6 def region @region end |
#setup ⇒ Object Also known as: setup?
Returns the value of attribute setup.
13 14 15 |
# File 'lib/vagrant-simplecloud/config.rb', line 13 def setup @setup end |
#size ⇒ Object
Returns the value of attribute size.
7 8 9 |
# File 'lib/vagrant-simplecloud/config.rb', line 7 def size @size end |
#ssh_key_name ⇒ Object
Returns the value of attribute ssh_key_name.
12 13 14 |
# File 'lib/vagrant-simplecloud/config.rb', line 12 def ssh_key_name @ssh_key_name end |
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/vagrant-simplecloud/config.rb', line 4 def token @token end |
#user_data ⇒ Object
Returns the value of attribute user_data.
14 15 16 |
# File 'lib/vagrant-simplecloud/config.rb', line 14 def user_data @user_data end |
Instance Method Details
#finalize! ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vagrant-simplecloud/config.rb', line 32 def finalize! @token = ENV['DO_TOKEN'] if @token == UNSET_VALUE @image = 'ubuntu-14-04-x64' if @image == UNSET_VALUE @region = 'nyc2' if @region == UNSET_VALUE @size = '512mb' if @size == UNSET_VALUE @private_networking = false if @private_networking == UNSET_VALUE @ipv6 = false if @ipv6 == UNSET_VALUE @backups_enabled = false if @backups_enabled == UNSET_VALUE @ca_path = nil if @ca_path == UNSET_VALUE @ssh_key_name = 'Vagrant' if @ssh_key_name == UNSET_VALUE @setup = true if @setup == UNSET_VALUE @user_data = nil if @user_data == UNSET_VALUE end |
#validate(machine) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vagrant-simplecloud/config.rb', line 46 def validate(machine) errors = [] errors << I18n.t('vagrant_simple_cloud.config.token') if !@token key = machine.config.ssh.private_key_path key = key[0] if key.is_a?(Array) if !key errors << I18n.t('vagrant_simple_cloud.config.private_key') elsif !File.file?(File.("#{key}.pub", machine.env.root_path)) errors << I18n.t('vagrant_simple_cloud.config.public_key', { :key => "#{key}.pub" }) end { 'Simple Cloud Provider' => errors } end |