Merge pull request #2313 from jeffasinger/salt-overstate
provisioner/salt: adding overstate support to the salt provisioner
This commit is contained in:
commit
193f172b7c
|
@ -13,6 +13,7 @@ module VagrantPlugins
|
|||
attr_accessor :master_key
|
||||
attr_accessor :master_pub
|
||||
attr_accessor :run_highstate
|
||||
attr_accessor :run_overstate
|
||||
attr_accessor :always_install
|
||||
attr_accessor :bootstrap_script
|
||||
attr_accessor :verbose
|
||||
|
@ -36,6 +37,7 @@ module VagrantPlugins
|
|||
@master_key = UNSET_VALUE
|
||||
@master_pub = UNSET_VALUE
|
||||
@run_highstate = UNSET_VALUE
|
||||
@run_overstate = UNSET_VALUE
|
||||
@always_install = UNSET_VALUE
|
||||
@bootstrap_script = UNSET_VALUE
|
||||
@verbose = UNSET_VALUE
|
||||
|
@ -58,6 +60,7 @@ module VagrantPlugins
|
|||
@master_key = nil if @master_key == UNSET_VALUE
|
||||
@master_pub = nil if @master_pub == UNSET_VALUE
|
||||
@run_highstate = nil if @run_highstate == UNSET_VALUE
|
||||
@run_overstate = nil if @run_overstate == UNSET_VALUE
|
||||
@always_install = nil if @always_install == UNSET_VALUE
|
||||
@bootstrap_script = nil if @bootstrap_script == UNSET_VALUE
|
||||
@verbose = nil if @verbose == UNSET_VALUE
|
||||
|
|
|
@ -7,6 +7,7 @@ module VagrantPlugins
|
|||
upload_configs
|
||||
upload_keys
|
||||
run_bootstrap_script
|
||||
call_overstate
|
||||
call_highstate
|
||||
end
|
||||
|
||||
|
@ -222,6 +223,23 @@ module VagrantPlugins
|
|||
@machine.env.ui.info "Salt did not need installing or configuring."
|
||||
end
|
||||
end
|
||||
def call_overstate
|
||||
if @config.run_overstate
|
||||
if @config.install_master
|
||||
@machine.env.ui.info "Calling state.overstate... (this may take a while)"
|
||||
@machine.communicate.sudo("salt '*' saltutil.sync_all")
|
||||
@machine.communicate.sudo("salt-run state.over") do |type, data|
|
||||
if @config.verbose
|
||||
@machine.env.ui.info(data)
|
||||
end
|
||||
end
|
||||
else
|
||||
@machine.env.ui.info "run_overstate does not make sense on a minion. Not running state.overstate."
|
||||
end
|
||||
else
|
||||
@machine.env.ui.info "run_overstate set to false. Not running state.overstate."
|
||||
end
|
||||
end
|
||||
|
||||
def call_highstate
|
||||
if @config.run_highstate
|
||||
|
|
Loading…
Reference in New Issue