Class: VagrantPlugins::Rightscale::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-rightscale/config.rb

Constant Summary collapse

VAGRANT_CLOUD_NAME =

This plugin requires that you have the BlueSkies cloud registered in your RightScale account. This cloud is currently in private beta. Contact [email protected] for more information.

"BlueSkies"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



22
23
24
25
26
27
28
29
# File 'lib/vagrant-rightscale/config.rb', line 22

def initialize
  super

  # default all local instance variables to UNSET_VALUE
  setters = (t.methods - Object.methods).select { |m| m =~ /=/ }
  puts setters.inspect
  setters.map { |var| t.instance_variable_set(:@var, UNSET_VALUE) }
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



12
13
14
# File 'lib/vagrant-rightscale/config.rb', line 12

def 
  @account_id
end

#api_urlObject

Returns the value of attribute api_url.



13
14
15
# File 'lib/vagrant-rightscale/config.rb', line 13

def api_url
  @api_url
end

#cloud_nameObject

Returns the value of attribute cloud_name.



17
18
19
# File 'lib/vagrant-rightscale/config.rb', line 17

def cloud_name
  @cloud_name
end

#deployment_nameObject

Returns the value of attribute deployment_name.



15
16
17
# File 'lib/vagrant-rightscale/config.rb', line 15

def deployment_name
  @deployment_name
end

#emailObject

Returns the value of attribute email.



10
11
12
# File 'lib/vagrant-rightscale/config.rb', line 10

def email
  @email
end

#multi_cloud_image_nameObject

Returns the value of attribute multi_cloud_image_name.



16
17
18
# File 'lib/vagrant-rightscale/config.rb', line 16

def multi_cloud_image_name
  @multi_cloud_image_name
end

#operational_scriptsObject

Returns the value of attribute operational_scripts.



20
21
22
# File 'lib/vagrant-rightscale/config.rb', line 20

def operational_scripts
  @operational_scripts
end

#passwordObject

Returns the value of attribute password.



11
12
13
# File 'lib/vagrant-rightscale/config.rb', line 11

def password
  @password
end

#server_inputsObject

Returns the value of attribute server_inputs.



19
20
21
# File 'lib/vagrant-rightscale/config.rb', line 19

def server_inputs
  @server_inputs
end

#server_nameObject

Returns the value of attribute server_name.



18
19
20
# File 'lib/vagrant-rightscale/config.rb', line 18

def server_name
  @server_name
end

#servertemplateObject

name or id



14
15
16
# File 'lib/vagrant-rightscale/config.rb', line 14

def servertemplate
  @servertemplate
end

Instance Method Details

#finalize!Object

This method is called only once ever on the final configuration object in order to set defaults. If finalize! is called, that configuration will never be merged again, it is final. This lets you detect any UNSET_VALUE and set the proper default.



35
36
37
# File 'lib/vagrant-rightscale/config.rb', line 35

def finalize!
  @cloud_name = VAGRANT_CLOUD_NAME if @cloud_name == UNSET_VALUE || @cloud_name == nil
end

#validate(machine) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/vagrant-rightscale/config.rb', line 39

def validate(machine)

  # define the set of required options
  required_values = {
    "email" => @email,
    "password" => @password,
    "account_id" => @account_id
  }

  # verify all required options have a value
  required_values.keys.each do |key|
    if required_values[key] == UNSET_VALUE || required_values[key] == nil
      return { "rightscale" => ["you must supply a value for #{key}"] }
    end
  end

  {}
end