Setting python version back to 3.x since there some issues with Ansible version detection for pip installation.

This commit is contained in:
Alexzander thunder Shevchenko 2020-04-05 15:03:01 +03:00
parent d1d214f6e2
commit 4caa5e1434
2 changed files with 15 additions and 6 deletions

View File

@ -24,12 +24,15 @@ module VagrantPlugins
private
def self.ansible_apk_install(machine)
machine.communicate.sudo "apk add --update --no-cache python ansible"
machine.communicate.sudo "apk add --update --no-cache python3 ansible"
machine.communicate.sudo "if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi"
machine.communicate.sudo "if [ ! -e /usr/bin/pip ]; then ln -sf pip3 /usr/bin/pip ; fi"
end
def self.pip_setup(machine, pip_install_cmd = "")
machine.communicate.sudo "apk add --update --no-cache python"
machine.communicate.sudo "apk add --update --no-cache --virtual .build-deps python-dev libffi-dev openssl-dev build-base"
machine.communicate.sudo "apk add --update --no-cache python3"
machine.communicate.sudo "if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi"
machine.communicate.sudo "apk add --update --no-cache --virtual .build-deps python3-dev libffi-dev openssl-dev build-base"
Pip::get_pip machine, pip_install_cmd
end

View File

@ -26,9 +26,11 @@ describe VagrantPlugins::Ansible::Cap::Guest::Alpine::AnsibleInstall do
describe "#pip_setup" do
it "install required alpine packages for pip" do
expect(communicator).to receive(:sudo).once.ordered.
with("apk add --update --no-cache python")
with("apk add --update --no-cache python3")
expect(communicator).to receive(:sudo).once.ordered.
with("apk add --update --no-cache --virtual .build-deps python-dev libffi-dev openssl-dev build-base")
with("if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi")
expect(communicator).to receive(:sudo).once.ordered.
with("apk add --update --no-cache --virtual .build-deps python3-dev libffi-dev openssl-dev build-base")
subject.pip_setup(machine)
end
@ -41,7 +43,11 @@ describe VagrantPlugins::Ansible::Cap::Guest::Alpine::AnsibleInstall do
describe "when install_mode is :default (or unknown)" do
it "installs ansible with 'apk' package manager" do
expect(communicator).to receive(:sudo).once.ordered.
with("apk add --update --no-cache python ansible")
with("apk add --update --no-cache python3 ansible")
expect(communicator).to receive(:sudo).once.ordered.
with("if [ ! -e /usr/bin/python ]; then ln -sf python3 /usr/bin/python ; fi")
expect(communicator).to receive(:sudo).once.ordered.
with("if [ ! -e /usr/bin/pip ]; then ln -sf pip3 /usr/bin/pip ; fi")
subject.ansible_install(machine, :default, "", "", "")
end