Class: VagrantPlugins::Salt::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/vagrant-salt/config.rb', line 30

def initialize
  @minion_config = UNSET_VALUE
  @minion_key = UNSET_VALUE
  @minion_pub = UNSET_VALUE
  @master_config = UNSET_VALUE
  @master_key = UNSET_VALUE
  @master_pub = UNSET_VALUE
  @run_highstate = UNSET_VALUE
  @always_install = UNSET_VALUE
  @accept_keys = UNSET_VALUE
  @bootstrap_script = UNSET_VALUE
  @verbose = UNSET_VALUE
  @temp_config_dir = UNSET_VALUE
  @install_type = UNSET_VALUE
  @install_args = UNSET_VALUE
  @install_master = UNSET_VALUE
  @install_syndic = UNSET_VALUE
  @no_minion = UNSET_VALUE
  @bootstrap_options = UNSET_VALUE
end

Instance Attribute Details

#accept_keysObject

Returns the value of attribute accept_keys.



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

def accept_keys
  @accept_keys
end

#always_installObject

Returns the value of attribute always_install.



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

def always_install
  @always_install
end

#bootstrap_optionsObject

Returns the value of attribute bootstrap_options.



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

def bootstrap_options
  @bootstrap_options
end

#bootstrap_scriptObject

Returns the value of attribute bootstrap_script.



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

def bootstrap_script
  @bootstrap_script
end

#install_argsObject

Returns the value of attribute install_args.



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

def install_args
  @install_args
end

#install_masterObject

Returns the value of attribute install_master.



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

def install_master
  @install_master
end

#install_syndicObject

Returns the value of attribute install_syndic.



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

def install_syndic
  @install_syndic
end

#install_typeObject

Returns the value of attribute install_type.



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

def install_type
  @install_type
end

#master_configObject

Returns the value of attribute master_config.



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

def master_config
  @master_config
end

#master_keyObject

Returns the value of attribute master_key.



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

def master_key
  @master_key
end

#master_pubObject

Returns the value of attribute master_pub.



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

def master_pub
  @master_pub
end

#minion_configObject

salty-vagrant options



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

def minion_config
  @minion_config
end

#minion_keyObject

Returns the value of attribute minion_key.



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

def minion_key
  @minion_key
end

#minion_pubObject

Returns the value of attribute minion_pub.



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

def minion_pub
  @minion_pub
end

#no_minionObject

Returns the value of attribute no_minion.



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

def no_minion
  @no_minion
end

#run_highstateObject

Returns the value of attribute run_highstate.



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

def run_highstate
  @run_highstate
end

#temp_config_dirObject

bootstrap options



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

def temp_config_dir
  @temp_config_dir
end

#verboseObject

Returns the value of attribute verbose.



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

def verbose
  @verbose
end

Instance Method Details

#finalize!Object



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/vagrant-salt/config.rb', line 51

def finalize!
  @minion_config      = nil if @minion_config == UNSET_VALUE
  @minion_key         = nil if @minion_key == UNSET_VALUE
  @minion_pub         = nil if @minion_pub == UNSET_VALUE
  @master_config      = nil if @master_config == UNSET_VALUE
  @master_key         = nil if @master_key == UNSET_VALUE
  @master_pub         = nil if @master_pub == UNSET_VALUE
  @run_highstate      = nil if @run_highstate == UNSET_VALUE
  @always_install     = nil if @always_install == UNSET_VALUE
  @accept_keys        = nil if @accept_keys == UNSET_VALUE
  @bootstrap_script   = nil if @bootstrap_script == UNSET_VALUE
  @verbose            = nil if @verbose == UNSET_VALUE
  @temp_config_dir    = nil if @temp_config_dir == UNSET_VALUE
  @install_type       = nil if @install_type == UNSET_VALUE
  @install_args       = nil if @install_args == UNSET_VALUE
  @install_master     = nil if @install_master == UNSET_VALUE
  @install_syndic     = nil if @install_syndic == UNSET_VALUE
  @no_minion          = nil if @no_minion == UNSET_VALUE
  @bootstrap_options  = nil if @bootstrap_options == UNSET_VALUE

end

#validate(machine) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/vagrant-salt/config.rb', line 73

def validate(machine)
  errors = []
  if @minion_key || @minion_pub
    if !@minion_key || !@minion_pub
      errors << @minion_pub
    end
  end

  if @master_key && @master_pub
    if !@minion_key && !@minion_pub
      errors << I18n.t("salt.missing_key")
    end
  end

  if @accept_keys && @no_minion
    errors << I18n.t("salt.accept_key_no_minion")
  elsif @accept_keys && !@install_master
    errors << I18n.t("salt.accept_key_no_master")
  end

  if @install_master && !@no_minion && !@accept_keys && @run_highstate
    errors << I18n.t("salt.must_accept_keys")
  end

  return {"salt" => errors}
end