summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorDavid Schmitt <david@schmitt.edv-bus.at>2007-10-06 10:11:47 +0200
committerDavid Schmitt <david@schmitt.edv-bus.at>2007-10-06 10:11:47 +0200
commit2521bf14457f6377d1fef1185ef93e2ba91180d2 (patch)
tree10d09d01f95a346fc3f76605d4cb1e9c93e3f8d0 /plugins
parent5761bef98c65edbc51615b3d043c126b4abbd66f (diff)
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.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/facter/acpi_available.rb10
-rwxr-xr-xplugins/facter/interfaces.rb13
2 files changed, 23 insertions, 0 deletions
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