provisioners/salt: error if minion_config missing

This commit is contained in:
Kenny Rasschaert 2014-04-19 23:24:30 +02:00
parent ceb90c5aac
commit fc95e77237
3 changed files with 27 additions and 0 deletions

View File

@ -90,6 +90,13 @@ module VagrantPlugins
end
end
if @master_config
expanded = Pathname.new(@master_config).expand_path(machine.env.root_path)
if !expanded.file?
errors << I18n.t("vagrant.provisioners.salt.master_config_nonexist")
end
end
if @minion_key || @minion_pub
if !@minion_key || !@minion_pub
errors << I18n.t("vagrant.provisioners.salt.missing_key")

View File

@ -1635,6 +1635,8 @@ en:
salt:
minion_config_nonexist: |-
The specified minion_config file could not be found.
master_config_nonexist: |-
The specified master_config file could not be found.
missing_key: |-
You must include both public and private keys.
must_accept_keys: |-

View File

@ -42,5 +42,23 @@ describe VagrantPlugins::Salt::Config do
expect(result[error_key]).to be_empty
end
end
context "master_config" do
it "fails if master_config is set and missing" do
subject.master_config = "/ceci/nest/pas/une/path"
subject.finalize!
result = subject.validate(machine)
expect(result[error_key]).to_not be_empty
end
it "is valid if is set and not missing" do
subject.master_config = File.expand_path(__FILE__)
subject.finalize!
result = subject.validate(machine)
expect(result[error_key]).to be_empty
end
end
end
end