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