Class: VagrantPlugins::Dustcloud::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Dustcloud::Config
- Defined in:
- lib/vagrant-dustcloud/config.rb
Instance Attribute Summary collapse
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 |
# File 'lib/vagrant-dustcloud/config.rb', line 18 def initialize() @token_file = UNSET_VALUE @token = UNSET_VALUE @image = UNSET_VALUE @flavor = UNSET_VALUE end |
Instance Attribute Details
#flavor ⇒ String
16 17 18 |
# File 'lib/vagrant-dustcloud/config.rb', line 16 def flavor @flavor end |
#image ⇒ String
13 14 15 |
# File 'lib/vagrant-dustcloud/config.rb', line 13 def image @image end |
#token ⇒ String
10 11 12 |
# File 'lib/vagrant-dustcloud/config.rb', line 10 def token @token end |
#token_file ⇒ String
7 8 9 |
# File 'lib/vagrant-dustcloud/config.rb', line 7 def token_file @token_file end |
Instance Method Details
#finalize! ⇒ Object
25 26 27 28 29 30 |
# File 'lib/vagrant-dustcloud/config.rb', line 25 def finalize! @token_file = ENV['HOME'].to_s + '/.dustcloud' if @token_file == UNSET_VALUE @token = Credentials.new.get_token(@token_file) if @token == UNSET_VALUE @image = nil if @image == UNSET_VALUE @flavor = "tiny" if @flavor == UNSET_VALUE end |
#validate(machine) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/vagrant-dustcloud/config.rb', line 32 def validate(machine) errors = _detected_errors errors << "No token specified" if @token.nil? || @token == "" errors << "No image specified" if @image.nil? || @image == "" { "LUDD DUSTCloud Provider" => errors } end |