[minor] Align Ruby formatting across ansible_local files
GH-11148: Remove unwanted formatting changes proposed in 920361150f
.
This commit is contained in:
parent
a2b87eace4
commit
069122f42c
|
@ -1,5 +1,5 @@
|
||||||
require_relative '../../../errors'
|
require_relative "../../../errors"
|
||||||
require_relative '../pip/pip'
|
require_relative "../pip/pip"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Ansible
|
module Ansible
|
||||||
|
@ -8,25 +8,27 @@ module VagrantPlugins
|
||||||
module Arch
|
module Arch
|
||||||
module AnsibleInstall
|
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
|
case install_mode
|
||||||
when :pip
|
when :pip
|
||||||
pip_setup machine, pip_install_cmd
|
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
|
when :pip_args_only
|
||||||
pip_setup machine, pip_install_cmd
|
pip_setup machine, pip_install_cmd
|
||||||
Pip::pip_install machine, '', '', pip_args, false
|
Pip::pip_install machine, "", "", pip_args, false
|
||||||
|
|
||||||
else
|
else
|
||||||
machine.communicate.sudo 'pacman -Syy --noconfirm'
|
machine.communicate.sudo "pacman -Syy --noconfirm"
|
||||||
machine.communicate.sudo 'pacman -S --noconfirm ansible'
|
machine.communicate.sudo "pacman -S --noconfirm ansible"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.pip_setup(machine, pip_install_cmd='')
|
private
|
||||||
machine.communicate.sudo 'pacman -Syy --noconfirm'
|
|
||||||
machine.communicate.sudo 'pacman -S --noconfirm base-devel curl git'
|
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
|
Pip::get_pip machine, pip_install_cmd
|
||||||
end
|
end
|
||||||
|
@ -37,5 +39,3 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,7 @@ module VagrantPlugins
|
||||||
module Debian
|
module Debian
|
||||||
module AnsibleInstall
|
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
|
case install_mode
|
||||||
when :pip
|
when :pip
|
||||||
pip_setup machine, pip_install_cmd
|
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"
|
machine.communicate.sudo "DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --option \"Dpkg::Options::=--force-confold\" ansible"
|
||||||
end
|
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 "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"
|
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
|
Pip::get_pip machine, pip_install_cmd
|
||||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
||||||
module Fedora
|
module Fedora
|
||||||
module AnsibleInstall
|
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
|
case install_mode
|
||||||
when :pip
|
when :pip
|
||||||
pip_setup machine, pip_install_cmd
|
pip_setup machine, pip_install_cmd
|
||||||
|
@ -25,7 +25,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
private
|
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)
|
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"
|
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"
|
||||||
|
|
|
@ -24,15 +24,15 @@ module VagrantPlugins
|
||||||
machine.communicate.sudo pip_install
|
machine.communicate.sudo pip_install
|
||||||
end
|
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
|
# 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.
|
# to circumvent the pip setup by passing in nothing.
|
||||||
# Thus, we stick with the default on an empty string.
|
# Thus, we stick with the default on an empty string.
|
||||||
# Typecast added in the check for safety.
|
# Typecast added in the check for safety.
|
||||||
|
|
||||||
if pip_install_cmd.to_s.empty?
|
if pip_install_cmd.to_s.empty?
|
||||||
pip_install_cmd=DEFAULT_PIP_INSTALL_CMD
|
pip_install_cmd = DEFAULT_PIP_INSTALL_CMD
|
||||||
end
|
end
|
||||||
|
|
||||||
machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing_pip")
|
machine.ui.detail I18n.t("vagrant.provisioners.ansible.installing_pip")
|
||||||
|
|
|
@ -8,7 +8,7 @@ module VagrantPlugins
|
||||||
module RedHat
|
module RedHat
|
||||||
module AnsibleInstall
|
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
|
case install_mode
|
||||||
when :pip
|
when :pip
|
||||||
pip_setup machine, pip_install_cmd
|
pip_setup machine, pip_install_cmd
|
||||||
|
@ -33,7 +33,7 @@ module VagrantPlugins
|
||||||
machine.communicate.sudo "#{rpm_package_manager} -y --enablerepo=epel install ansible"
|
machine.communicate.sudo "#{rpm_package_manager} -y --enablerepo=epel install ansible"
|
||||||
end
|
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)
|
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")
|
machine.communicate.sudo("#{rpm_package_manager} -y install curl gcc libffi-devel openssl-devel python-crypto python-devel python-setuptools")
|
||||||
|
|
|
@ -7,7 +7,7 @@ module VagrantPlugins
|
||||||
module Ubuntu
|
module Ubuntu
|
||||||
module AnsibleInstall
|
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
|
if install_mode != :default
|
||||||
Debian::AnsibleInstall::ansible_install machine, install_mode, ansible_version, pip_args, pip_install_cmd
|
Debian::AnsibleInstall::ansible_install machine, install_mode, ansible_version, pip_args, pip_install_cmd
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,28 +23,37 @@ describe VagrantPlugins::Ansible::Cap::Guest::Pip do
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "#get_pip" do
|
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
|
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)
|
subject.get_pip(machine)
|
||||||
end
|
end
|
||||||
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
|
it "runs the supplied argument instead of default" do
|
||||||
pip_install_cmd = "foo"
|
pip_install_cmd = "foo"
|
||||||
|
|
||||||
expect(communicator).to receive(:execute).with(pip_install_cmd)
|
expect(communicator).to receive(:execute).with(pip_install_cmd)
|
||||||
|
|
||||||
subject.get_pip(machine, pip_install_cmd)
|
subject.get_pip(machine, pip_install_cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "installs pip using the default command if the argument is empty" do
|
it "installs pip using the default command if the argument is empty" do
|
||||||
pip_install_cmd = ""
|
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)
|
subject.get_pip(machine, pip_install_cmd)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "installs pip using the default command if the argument is nil" do
|
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)
|
subject.get_pip(machine, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue