[Pkg-puppet-devel] [facter] 72/180: (maint) Use Facter::Core::Execution for running commands
Stig Sandbeck Mathisen
ssm at debian.org
Mon Jun 30 15:06:32 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit 74ac1fc3582589fc058185b1781666966c7546b5
Author: Adrien Thebo <git at somethingsinistral.net>
Date: Thu May 1 12:04:20 2014 -0700
(maint) Use Facter::Core::Execution for running commands
---
lib/facter/util/dhcp_servers.rb | 6 +++---
spec/unit/dhcp_servers_spec.rb | 30 +++++++++++++++---------------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/lib/facter/util/dhcp_servers.rb b/lib/facter/util/dhcp_servers.rb
index f1aabd9..5cf8259 100644
--- a/lib/facter/util/dhcp_servers.rb
+++ b/lib/facter/util/dhcp_servers.rb
@@ -1,11 +1,11 @@
module Facter::Util::DHCPServers
def self.gateway_device
- Facter::Util::Resolution.exec("route -n").scan(/^0\.0\.0\.0.*?(\S+)$/).flatten.first
+ Facter::Core::Execution.exec("route -n").scan(/^0\.0\.0\.0.*?(\S+)$/).flatten.first
end
def self.devices
if Facter::Core::Execution.which('nmcli')
- Facter::Util::Resolution.exec("nmcli d").split("\n").select {|d| d =~ /\sconnected/i }.collect{ |line| line.split[0] }
+ Facter::Core::Execution.exec("nmcli d").split("\n").select {|d| d =~ /\sconnected/i }.collect{ |line| line.split[0] }
else
[]
end
@@ -13,7 +13,7 @@ module Facter::Util::DHCPServers
def self.device_dhcp_server(device)
if Facter::Core::Execution.which('nmcli')
- Facter::Util::Resolution.exec("nmcli d list iface #{device}").scan(/dhcp_server_identifier.*?(\d+\.\d+\.\d+\.\d+)$/).flatten.first
+ Facter::Core::Execution.exec("nmcli d list iface #{device}").scan(/dhcp_server_identifier.*?(\d+\.\d+\.\d+\.\d+)$/).flatten.first
end
end
end
diff --git a/spec/unit/dhcp_servers_spec.rb b/spec/unit/dhcp_servers_spec.rb
index d82e5e7..2c5e141 100644
--- a/spec/unit/dhcp_servers_spec.rb
+++ b/spec/unit/dhcp_servers_spec.rb
@@ -3,7 +3,7 @@ require 'spec_helper'
describe "DHCP server facts" do
describe "on Linux OS's" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("route -n").returns(my_fixture_read("route"))
+ Facter::Core::Execution.stubs(:exec).with("route -n").returns(my_fixture_read("route"))
end
describe "with nmcli available" do
@@ -13,9 +13,9 @@ describe "DHCP server facts" do
describe "with a main interface configured with DHCP" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_dhcp"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_dhcp"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_dhcp"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_dhcp"))
end
it "should produce a dhcp_servers fact that includes values for 'system' as well as each dhcp enabled interface" do
@@ -25,9 +25,9 @@ describe "DHCP server facts" do
describe "with a main interface NOT configured with DHCP" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_static"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_dhcp"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_static"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_dhcp"))
end
it "should a dhcp_servers fact that includes values for each dhcp enables interface and NO 'system' value" do
@@ -37,10 +37,10 @@ describe "DHCP server facts" do
describe "with no default gateway" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("route -n").returns(my_fixture_read("route_nogw"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_dhcp"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_dhcp"))
+ Facter::Core::Execution.stubs(:exec).with("route -n").returns(my_fixture_read("route_nogw"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_dhcp"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_dhcp"))
end
it "should a dhcp_servers fact that includes values for each dhcp enables interface and NO 'system' value" do
@@ -50,9 +50,9 @@ describe "DHCP server facts" do
describe "with no DHCP enabled interfaces" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_static"))
- Facter::Util::Resolution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_static"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface eth0").returns(my_fixture_read("nmcli_eth0_static"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d list iface wlan0").returns(my_fixture_read("nmcli_wlan0_static"))
end
it "should not produce a dhcp_servers fact" do
@@ -62,7 +62,7 @@ describe "DHCP server facts" do
describe "with no CONNECTED devices" do
before :each do
- Facter::Util::Resolution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices_disconnected"))
+ Facter::Core::Execution.stubs(:exec).with("nmcli d").returns(my_fixture_read("nmcli_devices_disconnected"))
end
it "should not produce a dhcp_servers fact" do
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list