Skip to content

Instantly share code, notes, and snippets.

@madAndroid
Created July 25, 2013 08:18
Show Gist options
  • Save madAndroid/6077800 to your computer and use it in GitHub Desktop.
Save madAndroid/6077800 to your computer and use it in GitHub Desktop.
diff --git a/puppet/scalefactory.com/modules/sf_defaults/lib/facter/sf_cucumber_vagrant.rb b/puppet/scalefactory.com/modules/sf_defaults/lib/facter/sf_cucumber_vagrant.rb
new file mode 100644
index 0000000..7c04456
--- /dev/null
+++ b/puppet/scalefactory.com/modules/sf_defaults/lib/facter/sf_cucumber_vagrant.rb
@@ -0,0 +1,21 @@
+# Copyright 2012-2013 The Scale Factory Limited. All rights reserved.
+
+# Check if puppet running inside a vagrant box
+
+if Facter.value('is_virtual') == 'true'
+
+ Facter.add('sf_cucumber_vagrant') do
+ vagrant_dir = '/vagrant'
+ ### Set fact if binary exists as file or symlinked alternative
+ if File.exists?(vagrant_dir)
+ vagrant = 'true'
+ else
+ vagrant = 'false'
+ end
+ setcode do
+ vagrant
+ end
+ end
+
+end
+
diff --git a/puppet/scalefactory.com/modules/sf_mcollective/templates/facts.yaml b/puppet/scalefactory.com/modules/sf_mcollective/templates/facts.yaml
index 8aacdc3..1ff0d7e 100644
--- a/puppet/scalefactory.com/modules/sf_mcollective/templates/facts.yaml
+++ b/puppet/scalefactory.com/modules/sf_mcollective/templates/facts.yaml
@@ -15,6 +15,11 @@
]
-%>
+<%
+ if @sf_cucumber_vagrant == 'true'
+ reject_keys << 'iptables_persistent_version'
+ end
+-%>
<% scope_hash.keys.select { |k| k.class == String and !reject_keys.index(k) }.sort.each do |k| -%>
<%= k %>: <%= scope_hash[k] %>
<% end %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment