move masterless config to apply to all platforms

This commit is contained in:
Michael Sarahan 2016-04-05 10:24:47 -05:00
parent 45cc01e6a9
commit 72e9f0fe10
1 changed files with 20 additions and 25 deletions

View File

@ -320,27 +320,18 @@ 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#{get_loglevel}#{get_colorize}#{get_pillar}"
if @config.minion_id
cmd += " --id #{@config.minion_id}"
end
@machine.communicate.sudo(cmd) do |type, data|
if @config.verbose
@machine.env.ui.info(data)
end
end
end
def call_highstate
if @config.run_highstate
local=""
if @config.masterless
call_masterless
elsif @config.run_highstate
local=" --local"
end
@machine.env.ui.info "Calling state.highstate... (this may take a while)"
if @config.install_master
unless @config.masterless?
@machine.communicate.sudo("salt '*' saltutil.sync_all")
@machine.communicate.sudo("salt '*' state.highstate --verbose#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
end
@machine.communicate.sudo("salt '*' state.highstate --verbose #{local}#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
if @config.verbose
@machine.env.ui.info(data.rstrip)
end
@ -348,15 +339,19 @@ module VagrantPlugins
else
if @machine.config.vm.communicator == :winrm
opts = { elevated: true }
unless @config.masterless?
@machine.communicate.execute("C:\\salt\\salt-call.bat saltutil.sync_all", opts)
@machine.communicate.execute("C:\\salt\\salt-call.bat state.highstate --retcode-passthrough #{get_loglevel}#{get_colorize}#{get_pillar}", opts) do |type, data|
end
@machine.communicate.execute("C:\\salt\\salt-call.bat state.highstate --retcode-passthrough #{local}#{get_loglevel}#{get_colorize}#{get_pillar}", opts) do |type, data|
if @config.verbose
@machine.env.ui.info(data.rstrip)
end
end
else
unless @config.masterless?
@machine.communicate.sudo("salt-call saltutil.sync_all")
@machine.communicate.sudo("salt-call state.highstate --retcode-passthrough #{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
end
@machine.communicate.sudo("salt-call state.highstate --retcode-passthrough #{local}#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
if @config.verbose
@machine.env.ui.info(data.rstrip)
end