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