Class: VagrantPlugins::Vmpooler::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verbose = false) ⇒ Config


Provider methods




89
90
91
92
93
94
95
96
97
# File 'lib/vagrant-vmpooler/config.rb', line 89

def initialize(verbose=false)
  @token = UNSET_VALUE
  @url = UNSET_VALUE
  @verbose = UNSET_VALUE
  @os = UNSET_VALUE
  @ttl = UNSET_VALUE
  @disk = UNSET_VALUE
  @password = UNSET_VALUE
end

Instance Attribute Details

#diskInteger

Increases default disk space by this size

Returns:

  • (Integer)


45
46
47
# File 'lib/vagrant-vmpooler/config.rb', line 45

def disk
  @disk
end

#osString

The type of operatingsystem to get from the pooler

Returns:

  • (String)


27
28
29
# File 'lib/vagrant-vmpooler/config.rb', line 27

def os
  @os
end

#passwordString

The password to use to log into the vmpooler machine

Returns:

  • (String)


33
34
35
# File 'lib/vagrant-vmpooler/config.rb', line 33

def password
  @password
end

#tokenString

The token used to obtain vms

Returns:

  • (String)


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

def token
  @token
end

#ttlInteger

How long the vm should stay active for

Returns:

  • (Integer)


39
40
41
# File 'lib/vagrant-vmpooler/config.rb', line 39

def ttl
  @ttl
end

#urlString

The url to your vmpooler installation

Returns:

  • (String)


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

def url
  @url
end

#verboseBoolean

Whether or not to run vmfloaty commands in verbose mode

Returns:

  • (Boolean)


21
22
23
# File 'lib/vagrant-vmpooler/config.rb', line 21

def verbose
  @verbose
end

Instance Method Details

#finalize!Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/vagrant-vmpooler/config.rb', line 63

def finalize!
  conf_file = read_config

  if conf_file['token']
    @token = conf_file['token']
  else
    @token = nil
  end

  if conf_file['url']
    @url = conf_file['url']
  else
    @url = nil
  end

  @verbose = false if @verbose == UNSET_VALUE
  @os = nil if @os == UNSET_VALUE
  @ttl = nil if @ttl == UNSET_VALUE
  @disk = nil if @disk == UNSET_VALUE
  @password = nil if @password == UNSET_VALUE
end

#read_configObject


Internal methods




53
54
55
56
57
58
59
60
61
# File 'lib/vagrant-vmpooler/config.rb', line 53

def read_config
  conf_file = {}
  begin
    conf_file = YAML.load_file("#{Dir.home}/.vmfloaty.yml")
  rescue
    # vagrant debug?
  end
  conf_file
end