Prevent fatal error caused by attempting to upload minion config to
privileged directory
This commit is contained in:
parent
8045869891
commit
ea7b277f41
|
@ -20,7 +20,6 @@ module VagrantPlugins
|
||||||
attr_accessor :bootstrap_script
|
attr_accessor :bootstrap_script
|
||||||
attr_accessor :verbose
|
attr_accessor :verbose
|
||||||
attr_accessor :seed_master
|
attr_accessor :seed_master
|
||||||
attr_accessor :config_dir
|
|
||||||
attr_reader :pillar_data
|
attr_reader :pillar_data
|
||||||
attr_accessor :colorize
|
attr_accessor :colorize
|
||||||
attr_accessor :log_level
|
attr_accessor :log_level
|
||||||
|
@ -65,7 +64,6 @@ module VagrantPlugins
|
||||||
@install_command = UNSET_VALUE
|
@install_command = UNSET_VALUE
|
||||||
@no_minion = UNSET_VALUE
|
@no_minion = UNSET_VALUE
|
||||||
@bootstrap_options = UNSET_VALUE
|
@bootstrap_options = UNSET_VALUE
|
||||||
@config_dir = UNSET_VALUE
|
|
||||||
@masterless = UNSET_VALUE
|
@masterless = UNSET_VALUE
|
||||||
@minion_id = UNSET_VALUE
|
@minion_id = UNSET_VALUE
|
||||||
@version = UNSET_VALUE
|
@version = UNSET_VALUE
|
||||||
|
@ -98,7 +96,6 @@ module VagrantPlugins
|
||||||
@install_command = nil if @install_command == UNSET_VALUE
|
@install_command = nil if @install_command == UNSET_VALUE
|
||||||
@no_minion = nil if @no_minion == UNSET_VALUE
|
@no_minion = nil if @no_minion == UNSET_VALUE
|
||||||
@bootstrap_options = nil if @bootstrap_options == UNSET_VALUE
|
@bootstrap_options = nil if @bootstrap_options == UNSET_VALUE
|
||||||
@config_dir = nil if @config_dir == UNSET_VALUE
|
|
||||||
@masterless = false if @masterless == UNSET_VALUE
|
@masterless = false if @masterless == UNSET_VALUE
|
||||||
@minion_id = nil if @minion_id == UNSET_VALUE
|
@minion_id = nil if @minion_id == UNSET_VALUE
|
||||||
@version = nil if @version == UNSET_VALUE
|
@version = nil if @version == UNSET_VALUE
|
||||||
|
@ -111,17 +108,6 @@ module VagrantPlugins
|
||||||
@pillar_data = Vagrant::Util::DeepMerge.deep_merge(@pillar_data, data)
|
@pillar_data = Vagrant::Util::DeepMerge.deep_merge(@pillar_data, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
def default_config_dir(machine)
|
|
||||||
guest_type = machine.config.vm.guest || :linux
|
|
||||||
|
|
||||||
# FIXME: there should be a way to do that a bit smarter
|
|
||||||
if guest_type == :windows
|
|
||||||
return "C:\\salt\\conf"
|
|
||||||
else
|
|
||||||
return "/etc/salt"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def validate(machine)
|
def validate(machine)
|
||||||
errors = _detected_errors
|
errors = _detected_errors
|
||||||
if @minion_config
|
if @minion_config
|
||||||
|
@ -161,10 +147,6 @@ module VagrantPlugins
|
||||||
errors << I18n.t("vagrant.provisioners.salt.must_accept_keys")
|
errors << I18n.t("vagrant.provisioners.salt.must_accept_keys")
|
||||||
end
|
end
|
||||||
|
|
||||||
if @config_dir.nil?
|
|
||||||
@config_dir = default_config_dir(machine)
|
|
||||||
end
|
|
||||||
|
|
||||||
return {"salt provisioner" => errors}
|
return {"salt provisioner" => errors}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -342,11 +342,6 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def call_highstate
|
def call_highstate
|
||||||
if @config.minion_config
|
|
||||||
@machine.env.ui.info "Copying salt minion config to #{@config.config_dir}"
|
|
||||||
@machine.communicate.upload(expanded_path(@config.minion_config).to_s, @config.config_dir + "/minion")
|
|
||||||
end
|
|
||||||
|
|
||||||
if @config.masterless
|
if @config.masterless
|
||||||
call_masterless
|
call_masterless
|
||||||
elsif @config.run_highstate
|
elsif @config.run_highstate
|
||||||
|
|
Loading…
Reference in New Issue