Class: VagrantAutoDNS::Cap::InstallIptables
- Inherits:
-
Object
- Object
- VagrantAutoDNS::Cap::InstallIptables
- Extended by:
- Common
- Defined in:
- lib/vagrant-autodns/cap/install_iptables.rb
Constant Summary collapse
- INSTALL_FLAG =
Flags to install packages on various linux platforms
{ 'apt-get' => 'install -y', 'aptitude' => 'install -y', 'yum' => 'install -y', 'pacman' => '-S --noconfirm', 'zypper' => 'install --noconfirm', 'apt-rpm' => 'install -y', }
Class Method Summary collapse
Methods included from Common
iptables_location, run_command
Class Method Details
.install_iptables(machine) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant-autodns/cap/install_iptables.rb', line 25 def self.install_iptables(machine) if iptables_location(machine).empty? #Get package manager pm_type = INSTALL_FLAG.keys.map{|p| "command -v #{p}"}.join(' || ') package_manager = run_command(machine, pm_type) #Install iptables install_flag = INSTALL_FLAG[package_manager[/[^\/]+$/]] run_command(machine, "#{package_manager} #{install_flag} iptables") end end |