[minor] Align Ruby formatting across ansible_local files

GH-11148: Remove unwanted formatting changes proposed in 920361150f.
This commit is contained in:
Gilles Cornu 2019-12-01 11:20:28 +01:00 committed by Brian Cain
parent a2b87eace4
commit 069122f42c
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
7 changed files with 36 additions and 28 deletions

View File

@ -1,5 +1,5 @@
require_relative '../../../errors'
require_relative '../pip/pip'
require_relative "../../../errors"
require_relative "../pip/pip"
module VagrantPlugins
module Ansible
@ -8,25 +8,27 @@ module VagrantPlugins
module Arch
module AnsibleInstall
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd='')
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
case install_mode
when :pip
pip_setup machine, pip_install_cmd
Pip::pip_install machine, 'ansible', ansible_version, pip_args, true
Pip::pip_install machine, "ansible", ansible_version, pip_args, true
when :pip_args_only
pip_setup machine, pip_install_cmd
Pip::pip_install machine, '', '', pip_args, false
Pip::pip_install machine, "", "", pip_args, false
else
machine.communicate.sudo 'pacman -Syy --noconfirm'
machine.communicate.sudo 'pacman -S --noconfirm ansible'
machine.communicate.sudo "pacman -Syy --noconfirm"
machine.communicate.sudo "pacman -S --noconfirm ansible"
end
end
def self.pip_setup(machine, pip_install_cmd='')
machine.communicate.sudo 'pacman -Syy --noconfirm'
machine.communicate.sudo 'pacman -S --noconfirm base-devel curl git'
private
def self.pip_setup(machine, pip_install_cmd = "")
machine.communicate.sudo "pacman -Syy --noconfirm"
machine.communicate.sudo "pacman -S --noconfirm base-devel curl git"
Pip::get_pip machine, pip_install_cmd
end
@ -37,5 +39,3 @@ module VagrantPlugins
end
end
end

View File

@ -7,8 +7,7 @@ module VagrantPlugins
module Debian
module AnsibleInstall
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd="")
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
case install_mode
when :pip
pip_setup machine, pip_install_cmd
@ -36,7 +35,7 @@ INLINE_CRIPT
machine.communicate.sudo "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --option \"Dpkg::Options::=--force-confold\" ansible"
end
def self.pip_setup(machine, pip_install_cmd="")
def self.pip_setup(machine, pip_install_cmd = "")
machine.communicate.sudo "apt-get update -y -qq"
machine.communicate.sudo "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --option \"Dpkg::Options::=--force-confold\" build-essential curl git libssl-dev libffi-dev python-dev"
Pip::get_pip machine, pip_install_cmd

View File

@ -8,7 +8,7 @@ module VagrantPlugins
module Fedora
module AnsibleInstall
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd="")
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
case install_mode
when :pip
pip_setup machine, pip_install_cmd
@ -25,7 +25,7 @@ module VagrantPlugins
private
def self.pip_setup(machine, pip_install_cmd="")
def self.pip_setup(machine, pip_install_cmd = "")
rpm_package_manager = Facts::rpm_package_manager(machine)
machine.communicate.sudo "#{rpm_package_manager} install -y curl gcc gmp-devel libffi-devel openssl-devel python-crypto python-devel python-dnf python-setuptools redhat-rpm-config"

View File

@ -24,15 +24,15 @@ module VagrantPlugins
machine.communicate.sudo pip_install
end
def self.get_pip(machine, pip_install_cmd=DEFAULT_PIP_INSTALL_CMD)
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
# 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.
# Typecast added in the check for safety.
if pip_install_cmd.to_s.empty?
pip_install_cmd=DEFAULT_PIP_INSTALL_CMD
pip_install_cmd = DEFAULT_PIP_INSTALL_CMD
end
machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing_pip")

View File

@ -8,7 +8,7 @@ module VagrantPlugins
module RedHat
module AnsibleInstall
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd="")
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
case install_mode
when :pip
pip_setup machine, pip_install_cmd
@ -33,7 +33,7 @@ module VagrantPlugins
machine.communicate.sudo "#{rpm_package_manager} -y --enablerepo=epel install ansible"
end
def self.pip_setup(machine, pip_install_cmd="")
def self.pip_setup(machine, pip_install_cmd = "")
rpm_package_manager = Facts::rpm_package_manager(machine)
machine.communicate.sudo("#{rpm_package_manager} -y install curl gcc libffi-devel openssl-devel python-crypto python-devel python-setuptools")

View File

@ -7,7 +7,7 @@ module VagrantPlugins
module Ubuntu
module AnsibleInstall
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd="")
def self.ansible_install(machine, install_mode, ansible_version, pip_args, pip_install_cmd = "")
if install_mode != :default
Debian::AnsibleInstall::ansible_install machine, install_mode, ansible_version, pip_args, pip_install_cmd
else

View File

@ -23,28 +23,37 @@ describe VagrantPlugins::Ansible::Cap::Guest::Pip do
end
describe "#get_pip" do
describe 'when no pip_install_cmd argument is provided' do
describe "when no pip_install_cmd argument is provided" do
it "installs pip using the default command" do
expect(communicator).to receive(:execute).with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
expect(communicator).to receive(:execute).
with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
subject.get_pip(machine)
end
end
describe 'when pip_install_cmd argument is provided' do
describe "when pip_install_cmd argument is provided" do
it "runs the supplied argument instead of default" do
pip_install_cmd = "foo"
expect(communicator).to receive(:execute).with(pip_install_cmd)
subject.get_pip(machine, pip_install_cmd)
end
it "installs pip using the default command if the argument is empty" do
pip_install_cmd = ""
expect(communicator).to receive(:execute).with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
expect(communicator).to receive(:execute).
with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
subject.get_pip(machine, pip_install_cmd)
end
it "installs pip using the default command if the argument is nil" do
expect(communicator).to receive(:execute).with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
expect(communicator).to receive(:execute).
with("curl https://bootstrap.pypa.io/get-pip.py | sudo python")
subject.get_pip(machine, nil)
end
end