Handling empty strings passed as pip_install_command.
This commit is contained in:
parent
2b0617fb64
commit
84df098135
|
@ -5,6 +5,8 @@ module VagrantPlugins
|
|||
module Guest
|
||||
module Pip
|
||||
|
||||
DEFAULT_PIP_INSTALL_CMD = "curl https://bootstrap.pypa.io/get-pip.py | sudo python"
|
||||
|
||||
def self.pip_install(machine, package = "", version = "", pip_args = "", upgrade = true)
|
||||
upgrade_arg = "--upgrade" if upgrade
|
||||
version_arg = ""
|
||||
|
@ -18,7 +20,17 @@ module VagrantPlugins
|
|||
machine.communicate.sudo "pip install #{args_array.join(' ')}"
|
||||
end
|
||||
|
||||
def self.get_pip(machine, pip_install_cmd="curl https://bootstrap.pypa.io/get-pip.py | sudo python")
|
||||
def self.get_pip(machine, pip_install_cmd=DEFAULT_PIP_INSTALL_CMD)
|
||||
|
||||
# The objective here is to get pip either by default
|
||||
# or by the argument passed in. The objective is not
|
||||
# to circumvent the pip setup by passing in nothing.
|
||||
# Thus, we stick with the default on an empty string.
|
||||
|
||||
if pip_install_cmd.empty?
|
||||
pip_install_cmd=DEFAULT_PIP_INSTALL_CMD
|
||||
end
|
||||
|
||||
machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing_pip")
|
||||
machine.communicate.execute pip_install_cmd
|
||||
end
|
||||
|
|
|
@ -36,6 +36,12 @@ describe VagrantPlugins::Ansible::Cap::Guest::Pip do
|
|||
expect(communicator).to receive(:execute).with(pip_install_command)
|
||||
subject.get_pip(machine,pip_install_command)
|
||||
end
|
||||
|
||||
it "installs pip using the default command if the argument is empty" do
|
||||
pip_install_command = ""
|
||||
expect(communicator).to receive(:execute).with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
|
||||
subject.get_pip(machine,pip_install_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue