Added tests and validation for python_version parameter
This commit is contained in:
parent
3524eb9ef4
commit
56861296fa
|
@ -163,6 +163,14 @@ module VagrantPlugins
|
|||
errors << I18n.t("vagrant.provisioners.salt.args_array")
|
||||
end
|
||||
|
||||
if @python_version && @python_version.is_a?(String) && !@python_version.scan(/\D/).empty?
|
||||
errors << I18n.t("vagrant.provisioners.salt.python_version")
|
||||
end
|
||||
|
||||
if @python_version && !(@python_version.is_a?(Integer) || @python_version.is_a?(String))
|
||||
errors << I18n.t("vagrant.provisioners.salt.python_version")
|
||||
end
|
||||
|
||||
return {"salt provisioner" => errors}
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2444,6 +2444,8 @@ en:
|
|||
You must accept keys when running highstate with master!
|
||||
args_array: |-
|
||||
You must set this value as an array.
|
||||
python_version: |-
|
||||
You must set this as an integer or string that represents an integer.
|
||||
|
||||
pushes:
|
||||
file:
|
||||
|
|
|
@ -114,5 +114,48 @@ describe VagrantPlugins::Salt::Config do
|
|||
expect(result[error_key]).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context "python_version" do
|
||||
it "is valid if is set and not missing" do
|
||||
subject.python_version = "2"
|
||||
subject.finalize!
|
||||
|
||||
result = subject.validate(machine)
|
||||
expect(result[error_key]).to be_empty
|
||||
end
|
||||
|
||||
it "can be a string" do
|
||||
subject.python_version = "2"
|
||||
subject.finalize!
|
||||
|
||||
result = subject.validate(machine)
|
||||
expect(result[error_key]).to be_empty
|
||||
end
|
||||
|
||||
it "can be an integer" do
|
||||
subject.python_version = 2
|
||||
subject.finalize!
|
||||
|
||||
result = subject.validate(machine)
|
||||
expect(result[error_key]).to be_empty
|
||||
end
|
||||
|
||||
it "is not a number that is not an integer" do
|
||||
subject.python_version = 2.7
|
||||
subject.finalize!
|
||||
|
||||
result = subject.validate(machine)
|
||||
expect(result[error_key]).to_not be_empty
|
||||
end
|
||||
|
||||
it "is not a string that does not parse to an integer" do
|
||||
subject.python_version = '2.7'
|
||||
subject.finalize!
|
||||
|
||||
result = subject.validate(machine)
|
||||
expect(result[error_key]).to_not be_empty
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -77,7 +77,7 @@ distribution's stable package manager, git tree-ish, daily ppa, or testing repos
|
|||
|
||||
* `version` (string, default: "2017.7.1") - Version of minion to be installed. Only supported on Windows guest machines.
|
||||
|
||||
* `python_version` (string, default: "2") - Python version of minion to be installed. Only valid for minion versions >= 2017.7.1. Only supported on Windows guest machines.
|
||||
* `python_version` (string, default: "2") - Major Python version of minion to be installed. Only valid for minion versions >= 2017.7.0. Only supported on Windows guest machines.
|
||||
|
||||
## Minion Options
|
||||
These only make sense when `no_minion` is `false`.
|
||||
|
|
Loading…
Reference in New Issue