From 89c071d374437c8c24dce52a75434dafe90ccd69 Mon Sep 17 00:00:00 2001 From: Philipp Panzer <4118161+yodaaut@users.noreply.github.com> Date: Tue, 25 May 2021 13:28:22 +0200 Subject: [PATCH 1/2] detects new versions of ansible-4.0.0+ Ansible has switched dependency between version 3.4.0 (ansible-base) and 4.0.0 (ansible-core), which now outputs new version scheme of "ansible [core 2.11.0]" instead of "ansible 2.10.9". This fix keeps old and new version detection working. --- plugins/provisioners/ansible/provisioner/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/provisioners/ansible/provisioner/base.rb b/plugins/provisioners/ansible/provisioner/base.rb index abe5d08ea..a2533ea9c 100644 --- a/plugins/provisioners/ansible/provisioner/base.rb +++ b/plugins/provisioners/ansible/provisioner/base.rb @@ -389,7 +389,7 @@ gathered version stdout version: if ansible_version_pattern _, @gathered_version, _ = ansible_version_pattern.captures if @gathered_version - @gathered_version_major = @gathered_version.match(/^(\d)\..+$/).captures[0].to_i + @gathered_version_major = @gathered_version.match(/(\d)\..+$/).captures[0].to_i end end end From afa71702e2f6ea2a17086e56333726c921301f70 Mon Sep 17 00:00:00 2001 From: Philipp Panzer <4118161+yodaaut@users.noreply.github.com> Date: Tue, 25 May 2021 23:40:04 +0200 Subject: [PATCH 2/2] add test for ansible core version format --- test/unit/plugins/provisioners/ansible/provisioner_test.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/plugins/provisioners/ansible/provisioner_test.rb b/test/unit/plugins/provisioners/ansible/provisioner_test.rb index 5d8527235..318ad0f19 100644 --- a/test/unit/plugins/provisioners/ansible/provisioner_test.rb +++ b/test/unit/plugins/provisioners/ansible/provisioner_test.rb @@ -325,6 +325,7 @@ VF "2.5.0.0-rc1": VagrantPlugins::Ansible::COMPATIBILITY_MODE_V2_0, "2.x.y.z": VagrantPlugins::Ansible::COMPATIBILITY_MODE_V2_0, "4.3.2.1": VagrantPlugins::Ansible::COMPATIBILITY_MODE_V2_0, + "[core 2.11.0]": VagrantPlugins::Ansible::COMPATIBILITY_MODE_V2_0, } valid_versions.each_pair do |ansible_version, mode| describe "and ansible version #{ansible_version}" do