Hide duplicate errors in Saltstack provisioner when verbose mode is on
This commit is contained in:
parent
1ed89b5b97
commit
8e4f0444e8
|
@ -331,10 +331,15 @@ module VagrantPlugins
|
||||||
|
|
||||||
def call_overstate
|
def call_overstate
|
||||||
if @config.run_overstate
|
if @config.run_overstate
|
||||||
|
# If verbose is on, do not duplicate a failed command's output in the error message.
|
||||||
|
ssh_opts = {}
|
||||||
|
if @config.verbose
|
||||||
|
ssh_opts = { error_key: :ssh_bad_exit_status_muted }
|
||||||
|
end
|
||||||
if @config.install_master
|
if @config.install_master
|
||||||
@machine.env.ui.info "Calling state.overstate... (this may take a while)"
|
@machine.env.ui.info "Calling state.overstate... (this may take a while)"
|
||||||
@machine.communicate.sudo("salt '*' saltutil.sync_all")
|
@machine.communicate.sudo("salt '*' saltutil.sync_all")
|
||||||
@machine.communicate.sudo("salt-run state.over") do |type, data|
|
@machine.communicate.sudo("salt-run state.over", ssh_opts) do |type, data|
|
||||||
if @config.verbose
|
if @config.verbose
|
||||||
@machine.env.ui.info(data)
|
@machine.env.ui.info(data)
|
||||||
end
|
end
|
||||||
|
@ -349,12 +354,18 @@ module VagrantPlugins
|
||||||
|
|
||||||
def call_highstate
|
def call_highstate
|
||||||
if @config.run_highstate
|
if @config.run_highstate
|
||||||
|
# If verbose is on, do not duplicate a failed command's output in the error message.
|
||||||
|
ssh_opts = {}
|
||||||
|
if @config.verbose
|
||||||
|
ssh_opts = { error_key: :ssh_bad_exit_status_muted }
|
||||||
|
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
|
||||||
unless @config.masterless?
|
unless @config.masterless?
|
||||||
@machine.communicate.sudo("salt '*' saltutil.sync_all")
|
@machine.communicate.sudo("salt '*' saltutil.sync_all")
|
||||||
end
|
end
|
||||||
@machine.communicate.sudo("salt '*' state.highstate --verbose#{get_masterless}#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
|
@machine.communicate.sudo("salt '*' state.highstate --verbose#{get_masterless}#{get_loglevel}#{get_colorize}#{get_pillar}", ssh_opts) do |type, data|
|
||||||
if @config.verbose
|
if @config.verbose
|
||||||
@machine.env.ui.info(data.rstrip)
|
@machine.env.ui.info(data.rstrip)
|
||||||
end
|
end
|
||||||
|
@ -365,6 +376,7 @@ module VagrantPlugins
|
||||||
unless @config.masterless?
|
unless @config.masterless?
|
||||||
@machine.communicate.execute("C:\\salt\\salt-call.bat saltutil.sync_all", opts)
|
@machine.communicate.execute("C:\\salt\\salt-call.bat saltutil.sync_all", opts)
|
||||||
end
|
end
|
||||||
|
# TODO: something equivalent to { error_key: :ssh_bad_exit_status_muted }?
|
||||||
@machine.communicate.execute("C:\\salt\\salt-call.bat state.highstate --retcode-passthrough#{get_masterless}#{get_loglevel}#{get_colorize}#{get_pillar}", opts) do |type, data|
|
@machine.communicate.execute("C:\\salt\\salt-call.bat state.highstate --retcode-passthrough#{get_masterless}#{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)
|
||||||
|
@ -374,7 +386,7 @@ module VagrantPlugins
|
||||||
unless @config.masterless?
|
unless @config.masterless?
|
||||||
@machine.communicate.sudo("salt-call saltutil.sync_all")
|
@machine.communicate.sudo("salt-call saltutil.sync_all")
|
||||||
end
|
end
|
||||||
@machine.communicate.sudo("salt-call state.highstate --retcode-passthrough#{get_masterless}#{get_loglevel}#{get_colorize}#{get_pillar}") do |type, data|
|
@machine.communicate.sudo("salt-call state.highstate --retcode-passthrough#{get_masterless}#{get_loglevel}#{get_colorize}#{get_pillar}", ssh_opts) do |type, data|
|
||||||
if @config.verbose
|
if @config.verbose
|
||||||
@machine.env.ui.info(data.rstrip)
|
@machine.env.ui.info(data.rstrip)
|
||||||
end
|
end
|
||||||
|
@ -403,14 +415,20 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If verbose is on, do not duplicate a failed command's output in the error message.
|
||||||
|
ssh_opts = {}
|
||||||
|
if @config.verbose
|
||||||
|
ssh_opts = { error_key: :ssh_bad_exit_status_muted }
|
||||||
|
end
|
||||||
|
|
||||||
@machine.env.ui.info "Running the following orchestrations: #{@config.orchestrations}"
|
@machine.env.ui.info "Running the following orchestrations: #{@config.orchestrations}"
|
||||||
@machine.env.ui.info "Running saltutil.sync_all before orchestrating"
|
@machine.env.ui.info "Running saltutil.sync_all before orchestrating"
|
||||||
@machine.communicate.sudo("salt '*' saltutil.sync_all", &log_output)
|
@machine.communicate.sudo("salt '*' saltutil.sync_all", ssh_opts, &log_output)
|
||||||
|
|
||||||
@config.orchestrations.each do |orchestration|
|
@config.orchestrations.each do |orchestration|
|
||||||
cmd = "salt-run -l info state.orchestrate #{orchestration}"
|
cmd = "salt-run -l info state.orchestrate #{orchestration}"
|
||||||
@machine.env.ui.info "Calling #{cmd}... (this may take a while)"
|
@machine.env.ui.info "Calling #{cmd}... (this may take a while)"
|
||||||
@machine.communicate.sudo(cmd, &log_output)
|
@machine.communicate.sudo(cmd, ssh_opts, &log_output)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue