Strip whitespace from ansible version
Note: strip! returns nil if there is nothing to be stripped
This commit is contained in:
parent
7528cdc235
commit
fecfe86cb8
@ -388,6 +388,7 @@ gathered version stdout version:
|
||||
ansible_version_pattern = first_line.match(/(^ansible\s+)(.+)$/)
|
||||
if ansible_version_pattern
|
||||
_, @gathered_version, _ = ansible_version_pattern.captures
|
||||
@gathered_version.strip!
|
||||
if @gathered_version
|
||||
@gathered_version_major = @gathered_version.match(/(\d)\..+$/).captures[0].to_i
|
||||
end
|
||||
|
||||
@ -984,6 +984,16 @@ VF
|
||||
end
|
||||
end
|
||||
|
||||
describe "whitespace in version string" do
|
||||
before do
|
||||
allow(subject).to receive(:gather_ansible_version).and_return("ansible #{config.version} \n...\n")
|
||||
end
|
||||
|
||||
it "sets the correct gathered_version" do
|
||||
expect(Vagrant::Util::Subprocess).to receive(:execute).with('ansible-playbook', any_args).and_return(default_execute_result)
|
||||
end
|
||||
end
|
||||
|
||||
describe "and there is an ansible version mismatch" do
|
||||
before do
|
||||
allow(subject).to receive(:gather_ansible_version).and_return("ansible 1.9.6\n...\n")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user