Adding overstate support to the salt provisioner

This commit is contained in:
Jeff Singer 2013-10-03 15:28:35 -04:00
parent bf70fba936
commit 852812f778
2 changed files with 21 additions and 0 deletions

View File

@ -13,6 +13,7 @@ module VagrantPlugins
attr_accessor :master_key attr_accessor :master_key
attr_accessor :master_pub attr_accessor :master_pub
attr_accessor :run_highstate attr_accessor :run_highstate
attr_accessor :run_overstate
attr_accessor :always_install attr_accessor :always_install
attr_accessor :bootstrap_script attr_accessor :bootstrap_script
attr_accessor :verbose attr_accessor :verbose
@ -36,6 +37,7 @@ module VagrantPlugins
@master_key = UNSET_VALUE @master_key = UNSET_VALUE
@master_pub = UNSET_VALUE @master_pub = UNSET_VALUE
@run_highstate = UNSET_VALUE @run_highstate = UNSET_VALUE
@run_overstate = UNSET_VALUE
@always_install = UNSET_VALUE @always_install = UNSET_VALUE
@bootstrap_script = UNSET_VALUE @bootstrap_script = UNSET_VALUE
@verbose = UNSET_VALUE @verbose = UNSET_VALUE
@ -58,6 +60,7 @@ module VagrantPlugins
@master_key = nil if @master_key == UNSET_VALUE @master_key = nil if @master_key == UNSET_VALUE
@master_pub = nil if @master_pub == UNSET_VALUE @master_pub = nil if @master_pub == UNSET_VALUE
@run_highstate = nil if @run_highstate == 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 @always_install = nil if @always_install == UNSET_VALUE
@bootstrap_script = nil if @bootstrap_script == UNSET_VALUE @bootstrap_script = nil if @bootstrap_script == UNSET_VALUE
@verbose = nil if @verbose == UNSET_VALUE @verbose = nil if @verbose == UNSET_VALUE

View File

@ -7,6 +7,7 @@ module VagrantPlugins
upload_configs upload_configs
upload_keys upload_keys
run_bootstrap_script run_bootstrap_script
call_overstate
call_highstate call_highstate
end end
@ -222,6 +223,23 @@ module VagrantPlugins
@machine.env.ui.info "Salt did not need installing or configuring." @machine.env.ui.info "Salt did not need installing or configuring."
end end
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 def call_highstate
if @config.run_highstate if @config.run_highstate