From 2521bf14457f6377d1fef1185ef93e2ba91180d2 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Sat, 6 Oct 2007 10:11:47 +0200 Subject: common: remove hand made plugins install defines and use matt's plugins patch This moves all facts and puppet plugins to the plugins/ directory of modules to get the benefits of Matt's plugins patch, that distributes these files before the configuration is requested. This reduces the number of configuration runs to convergence by one. --- plugins/facter/acpi_available.rb | 10 ++++++++++ plugins/facter/interfaces.rb | 13 +++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 plugins/facter/acpi_available.rb create mode 100755 plugins/facter/interfaces.rb (limited to 'plugins') diff --git a/plugins/facter/acpi_available.rb b/plugins/facter/acpi_available.rb new file mode 100644 index 0000000..216f608 --- /dev/null +++ b/plugins/facter/acpi_available.rb @@ -0,0 +1,10 @@ +# return whether acpi is available -- used for desiding whether to install the munin plugin +Facter.add("acpi_available") do + setcode do + if `acpi -t -B -A 2>/dev/null`.match(/\d/).nil? + "absent" + else + "present" + end + end +end diff --git a/plugins/facter/interfaces.rb b/plugins/facter/interfaces.rb new file mode 100755 index 0000000..a498d64 --- /dev/null +++ b/plugins/facter/interfaces.rb @@ -0,0 +1,13 @@ +# return the set of active interfaces as an array +Facter.add("interfaces") do + setcode do + `ip -o link show`.split(/\n/).collect do |line| + value = nil + matches = line.match(/^\d*: ([^:]*): <(.*,)?UP(,.*)?>/) + if !matches.nil? + value = matches[1] + end + value + end.compact.sort.join(" ") + end +end -- cgit v1.2.3