ENH: simpler masterless configuration.
This commit is contained in:
parent
b73415e84d
commit
3528af2db9
|
@ -23,6 +23,8 @@ module VagrantPlugins
|
|||
attr_reader :pillar_data
|
||||
attr_accessor :colorize
|
||||
attr_accessor :log_level
|
||||
attr_accessor :masterless
|
||||
attr_accessor :minion_id
|
||||
|
||||
## bootstrap options
|
||||
attr_accessor :temp_config_dir
|
||||
|
@ -58,6 +60,8 @@ module VagrantPlugins
|
|||
@no_minion = UNSET_VALUE
|
||||
@bootstrap_options = UNSET_VALUE
|
||||
@config_dir = UNSET_VALUE
|
||||
@masterless = UNSET_VALUE
|
||||
@minion_id = UNSET_VALUE
|
||||
end
|
||||
|
||||
def finalize!
|
||||
|
@ -85,7 +89,8 @@ module VagrantPlugins
|
|||
@no_minion = nil if @no_minion == UNSET_VALUE
|
||||
@bootstrap_options = nil if @bootstrap_options == UNSET_VALUE
|
||||
@config_dir = nil if @config_dir == UNSET_VALUE
|
||||
|
||||
@masterless = false if @masterless == UNSET_VALUE
|
||||
@minion_id = nil if @minion_id == UNSET_VALUE
|
||||
end
|
||||
|
||||
def pillar(data)
|
||||
|
@ -149,8 +154,6 @@ module VagrantPlugins
|
|||
|
||||
return {"salt provisioner" => errors}
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -304,13 +304,29 @@ module VagrantPlugins
|
|||
end
|
||||
end
|
||||
|
||||
def call_masterless
|
||||
@machine.env.ui.info "Calling state.highstate in local mode... (this may take a while)"
|
||||
cmd = "salt-call state.highstate --local"
|
||||
if @config.minion_id
|
||||
cmd += " --id #{@config.minion_id}"
|
||||
end
|
||||
cmd += " -l debug#{get_pillar}"
|
||||
@machine.communicate.sudo(cmd) do |type, data|
|
||||
if @config.verbose
|
||||
@machine.env.ui.info(data)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def call_highstate
|
||||
if @config.minion_config
|
||||
@machine.env.ui.info "Copying salt minion config to #{@config.config dir}"
|
||||
@machine.communicate.upload(expanded_path(@config.minion_config).to_s, @config.config_dir + "/minion")
|
||||
end
|
||||
|
||||
if @config.run_highstate
|
||||
if @config.masterless
|
||||
call_masterless
|
||||
elsif @config.run_highstate
|
||||
@machine.env.ui.info "Calling state.highstate... (this may take a while)"
|
||||
if @config.install_master
|
||||
@machine.communicate.sudo("salt '*' saltutil.sync_all")
|
||||
|
|
Loading…
Reference in New Issue