Class: VagrantPlugins::Dotvm::Config::Machine

Inherits:
AbstractConfig show all
Defined in:
lib/vagrant-dotvm/config/machine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractConfig

#populate, #replace_vars, #replace_vars!

Constructor Details

#initialize ⇒ Machine

Returns a new instance of Machine.



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/vagrant-dotvm/config/machine.rb', line 39

def initialize()
  @networks        = []
  @routes          = []
  @provision       = []
  @groups          = []
  @authorized_keys = []
  @hosts           = []
  @options         = {
    :virtualbox    => [],
  }
  @shared_folders  = []

  populate_shared_folders(
    [
      {
        "host"     => "%project.host%",
        "guest"    => "%project.guest%",
        "disabled" => false,
        "create"   => false,
        "type"     => nil,
      }
    ]
  )
end

Instance Attribute Details

#authorized_keys ⇒ Object

Returns the value of attribute authorized_keys.



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

def authorized_keys
  @authorized_keys
end

#autostart ⇒ Object

Returns the value of attribute autostart.



23
24
25
# File 'lib/vagrant-dotvm/config/machine.rb', line 23

def autostart
  @autostart
end

#boot_timeout ⇒ Object

Returns the value of attribute boot_timeout.



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

def boot_timeout
  @boot_timeout
end

#box ⇒ Object

Returns the value of attribute box.



7
8
9
# File 'lib/vagrant-dotvm/config/machine.rb', line 7

def box
  @box
end

#box_check_update ⇒ Object

Returns the value of attribute box_check_update.



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

def box_check_update
  @box_check_update
end

#box_download_ca_cert ⇒ Object

Returns the value of attribute box_download_ca_cert.



30
31
32
# File 'lib/vagrant-dotvm/config/machine.rb', line 30

def box_download_ca_cert
  @box_download_ca_cert
end

#box_download_ca_path ⇒ Object

Returns the value of attribute box_download_ca_path.



31
32
33
# File 'lib/vagrant-dotvm/config/machine.rb', line 31

def box_download_ca_path
  @box_download_ca_path
end

#box_download_checksum ⇒ Object

Returns the value of attribute box_download_checksum.



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

def box_download_checksum
  @box_download_checksum
end

#box_download_checksum_type ⇒ Object

Returns the value of attribute box_download_checksum_type.



28
29
30
# File 'lib/vagrant-dotvm/config/machine.rb', line 28

def box_download_checksum_type
  @box_download_checksum_type
end

#box_download_client_cert ⇒ Object

Returns the value of attribute box_download_client_cert.



29
30
31
# File 'lib/vagrant-dotvm/config/machine.rb', line 29

def box_download_client_cert
  @box_download_client_cert
end

#box_download_insecure ⇒ Object

Returns the value of attribute box_download_insecure.



32
33
34
# File 'lib/vagrant-dotvm/config/machine.rb', line 32

def box_download_insecure
  @box_download_insecure
end

#box_download_location_trusted ⇒ Object

Returns the value of attribute box_download_location_trusted.



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

def box_download_location_trusted
  @box_download_location_trusted
end

#box_url ⇒ Object

Returns the value of attribute box_url.



34
35
36
# File 'lib/vagrant-dotvm/config/machine.rb', line 34

def box_url
  @box_url
end

#box_version ⇒ Object

Returns the value of attribute box_version.



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

def box_version
  @box_version
end

#communicator ⇒ Object

Returns the value of attribute communicator.



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

def communicator
  @communicator
end

#cpucap ⇒ Object

Returns the value of attribute cpucap.



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

def cpucap
  @cpucap
end

#cpus ⇒ Object

Returns the value of attribute cpus.



9
10
11
# File 'lib/vagrant-dotvm/config/machine.rb', line 9

def cpus
  @cpus
end

#graceful_halt_timeout ⇒ Object

Returns the value of attribute graceful_halt_timeout.



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

def graceful_halt_timeout
  @graceful_halt_timeout
end

#groups ⇒ Object

Returns the value of attribute groups.



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

def groups
  @groups
end

#guest ⇒ Object

Returns the value of attribute guest.



36
37
38
# File 'lib/vagrant-dotvm/config/machine.rb', line 36

def guest
  @guest
end

#hostname ⇒ Object

name



6
7
8
# File 'lib/vagrant-dotvm/config/machine.rb', line 6

def hostname
  @hostname
end

#hosts ⇒ Object

Returns the value of attribute hosts.



24
25
26
# File 'lib/vagrant-dotvm/config/machine.rb', line 24

def hosts
  @hosts
end

#memory ⇒ Object

Returns the value of attribute memory.



8
9
10
# File 'lib/vagrant-dotvm/config/machine.rb', line 8

def memory
  @memory
end

#natnet ⇒ Object

Returns the value of attribute natnet.



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

def natnet
  @natnet
end

#networks ⇒ Object

Returns the value of attribute networks.



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

def networks
  @networks
end

#nick ⇒ Object

Returns the value of attribute nick.



5
6
7
# File 'lib/vagrant-dotvm/config/machine.rb', line 5

def nick
  @nick
end

#options ⇒ Object

Returns the value of attribute options.



25
26
27
# File 'lib/vagrant-dotvm/config/machine.rb', line 25

def options
  @options
end

#post_up_message ⇒ Object

Returns the value of attribute post_up_message.



22
23
24
# File 'lib/vagrant-dotvm/config/machine.rb', line 22

def post_up_message
  @post_up_message
end

#primary ⇒ Object

Returns the value of attribute primary.



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

def primary
  @primary
end

#provision ⇒ Object

Returns the value of attribute provision.



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

def provision
  @provision
end

#routes ⇒ Object

Returns the value of attribute routes.



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

def routes
  @routes
end

#shared_folders ⇒ Object

Returns the value of attribute shared_folders.



26
27
28
# File 'lib/vagrant-dotvm/config/machine.rb', line 26

def shared_folders
  @shared_folders
end

#usable_port_range ⇒ Object

Returns the value of attribute usable_port_range.



37
38
39
# File 'lib/vagrant-dotvm/config/machine.rb', line 37

def usable_port_range
  @usable_port_range
end

Instance Method Details

#name=(value) ⇒ Object



64
65
66
# File 'lib/vagrant-dotvm/config/machine.rb', line 64

def name=(value)
  @hostname = value
end

#populate_authorized_keys(data) ⇒ Object



112
113
114
115
116
117
118
119
120
# File 'lib/vagrant-dotvm/config/machine.rb', line 112

def populate_authorized_keys(data)
  raise "'authorized_keys' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass)

  data.to_a.each do |conf|
    item = AuthorizedKey.new
    item.populate conf
    @authorized_keys << item
  end
end

#populate_groups(data) ⇒ Object



104
105
106
107
108
109
110
# File 'lib/vagrant-dotvm/config/machine.rb', line 104

def populate_groups(data)
  raise "'groups' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass)

  data.to_a.each do |item|
    @groups << item
  end
end

#populate_hosts(data) ⇒ Object



122
123
124
125
126
127
128
129
130
# File 'lib/vagrant-dotvm/config/machine.rb', line 122

def populate_hosts(data)
  raise "'hosts' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass)

  data.to_a.each do |conf|
    item = Host.new
    item.populate conf
    @hosts << item
  end
end

#populate_networks(data) ⇒ Object



74
75
76
77
78
79
80
81
82
# File 'lib/vagrant-dotvm/config/machine.rb', line 74

def populate_networks(data)
  raise "'networks' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass)

  data.to_a.each do |conf|
    item = Network.new
    item.populate conf
    @networks << item
  end
end

#populate_options(data) ⇒ Object



132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/vagrant-dotvm/config/machine.rb', line 132

def populate_options(data)
  raise "'options' must be hash." unless data.kind_of?(Hash) || data.kind_of?(NilClass)

  data.to_h.each do |key, confs|
    key = key.to_sym
    raise "Invalid options category: #{key}." unless @options.has_key?(key)

    confs.to_a.each do |conf|
      item = Option.new
      item.populate conf
      @options[key] << item
    end
  end
end

#populate_provision(data) ⇒ Object



94
95
96
97
98
99
100
101
102
# File 'lib/vagrant-dotvm/config/machine.rb', line 94

def populate_provision(data)
  raise "'provision' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass)

  data.to_a.each do |conf|
    item = Provision.new
    item.populate conf
    @provision << item
  end
end

#populate_routes(data) ⇒ Object



84
85
86
87
88
89
90
91
92
# File 'lib/vagrant-dotvm/config/machine.rb', line 84

def populate_routes(data)
  raise "'routes' must be array." unless data.kind_of?(Array) || data.kind_of?(NilClass)

  data.to_a.each do |conf|
    item = Route.new
    item.populate conf
    @routes << item
  end
end

#populate_shared_folders(data) ⇒ Object



147
148
149
150
151
152
153
# File 'lib/vagrant-dotvm/config/machine.rb', line 147

def populate_shared_folders(data)
  data.to_a.each do |conf|
    item = SharedFolder.new
    item.populate conf
    @shared_folders << item
  end
end