Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit

  • Loading branch information...
commit d7b390d82086a028c92482ba163e472f7d06e886 0 parents
Justin Ellison justinellison authored
11 justintime-localmounts/Modulefile
@@ -0,0 +1,11 @@
+name 'justintime-localmounts'
+version '0.0.1'
+source 'UNKNOWN'
+author 'Justin Ellison <justin@techadvise.com'
+license 'UNKNOWN'
+summary 'Custom fact that returns all local mountpoints currently mounted'
+description 'UNKNOWN'
+project_page 'UNKNOWN'
+
+## Add dependencies, if any:
+# dependency 'username/name', '>= 1.2.0'
3  justintime-localmounts/README
@@ -0,0 +1,3 @@
+localmounts
+
+This custom fact simply looks in /proc/mounts, and returns any mountpoint currently mounted to a device in /dev. The reliance upon /proc limits this fact to Linux kernels. Patches welcome!
15 justintime-localmounts/lib/facter/localmounts.rb
@@ -0,0 +1,15 @@
+Facter.add("localmounts") do
+ confine :kernel => :linux
+ mountpoint = nil;
+ localmounts = []
+ setcode do
+ File.open("/proc/mounts").each do |line|
+ mountpoint = $1 if line =~ /^\/dev\S+\s+(\S+)\s+/
+ if mountpoint != nil
+ localmounts.push(mountpoint)
+ mountpoint = nil
+ end
+ end
+ localmounts.join(',')
+ end
+end
12 justintime-localmounts/metadata.json
@@ -0,0 +1,12 @@
+/*
++-----------------------------------------------------------------------+
+| |
+| ==> DO NOT EDIT THIS FILE! <== |
+| |
+| You should edit the `Modulefile` and run `puppet-module build` |
+| to generate the `metadata.json` file for your releases. |
+| |
++-----------------------------------------------------------------------+
+*/
+
+{}
6 justintime-localmounts/spec/spec.opts
@@ -0,0 +1,6 @@
+--format
+s
+--colour
+--loadby
+mtime
+--backtrace
18 justintime-localmounts/spec/spec_helper.rb
@@ -0,0 +1,18 @@
+require 'pathname'
+dir = Pathname.new(__FILE__).parent
+$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
+
+require 'mocha'
+require 'puppet'
+gem 'rspec', '=1.2.9'
+require 'spec/autorun'
+
+Spec::Runner.configure do |config|
+ config.mock_with :mocha
+end
+
+# We need this because the RAL uses 'should' as a method. This
+# allows us the same behaviour but with a different method name.
+class Object
+ alias :must :should
+end
1  justintime-localmounts/tests/init.pp
@@ -0,0 +1 @@
+include localmounts
Please sign in to comment.
Something went wrong with that request. Please try again.