Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../spec_helper'
require 'facter'
describe "Operating System fact" do
after do
Could not retrieve operatingsystem: unexpected invocation: FileTest.exists?('/etc/debian_version')
unsatisfied expectations:
- expected exactly once, not yet invoked: FileTest.exists?('/etc/enterprise-release')
- expected exactly once, not yet invoked: FileTest.exists?('/etc/ovs-release')
satisfied expectations:
- allowed any number of times, already invoked twice: #<Facter::Util::Fact:0x5d8824>.value(any_parameters)
diff --git a/lib/facter/lsbmajdistrelease.rb b/lib/facter/lsbmajdistrelease.rb
index f84c3c1..e091593 100644
--- a/lib/facter/lsbmajdistrelease.rb
+++ b/lib/facter/lsbmajdistrelease.rb
@@ -3,7 +3,7 @@
require 'facter'
Facter.add("lsbmajdistrelease") do
- confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE SLES Debian Ubuntu Gentoo}
+ confine :operatingsystem => %w{Solaris Linux Fedora RedHat CentOS SuSE SLES Debian Ubuntu Gentoo OEL OVS}
diff --git a/lib/facter/macaddress.rb b/lib/facter/macaddress.rb
index 94d00f4..f978b17 100644
--- a/lib/facter/macaddress.rb
+++ b/lib/facter/macaddress.rb
@@ -30,7 +30,7 @@ Facter.add(:macaddress) do
ether = nil
output = %x{/sbin/ifconfig}
- output.split(/^\S/).each_line do |str|
+ output.split(/^\S/).each do |str|
/**
* qemudProbe:
*
* Probe for the availability of the qemu driver, assume the
* presence of QEmu emulation if the binaries are installed
*/
static int qemudProbe(void)
{
if ((virFileExists("/usr/bin/qemu")) ||
diff --git a/lib/puppet/type/ssh_authorized_key.rb b/lib/puppet/type/ssh_authorized_key.rb
index 66cf3e7..997afb8 100644
--- a/lib/puppet/type/ssh_authorized_key.rb
+++ b/lib/puppet/type/ssh_authorized_key.rb
@@ -31,6 +31,20 @@ module Puppet
newproperty(:target) do
desc "The file in which to store the SSH key."
+
+ defaultto :absent
@pnasrat
pnasrat / gist:137226
Created June 28, 2009 10:08
Fix ec2 fact
diff --git a/lib/facter/ec2.rb b/lib/facter/ec2.rb
index ef84757..ea29d14 100644
--- a/lib/facter/ec2.rb
+++ b/lib/facter/ec2.rb
@@ -6,9 +6,12 @@ require 'open-uri'
require 'timeout'
def can_connect?(ip,port,wait_sec=2)
- Timeout::timeout(wait_sec) {open(ip, port)}
+ url = "http://#{ip}:#{port}/"
# Perform the actual change. This method can go either forward or
# backward, and produces an event.
def go
if self.noop?
@property.log "is %s, should be %s (noop)" % [property.is_to_s(@is), property.should_to_s(@should)]
return [event(:noop)]
end
should fail gracefully on load() if the state file is not a regular file
expected no Exception, got #<Errno::EACCES: Permission denied - C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/storage_test.3088.1>
./unit/util/storage.rb:178:
C:/Documents and Settings/Administrator/puppet/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb:22:in `run'
C:/Documents and Settings/Administrator/puppet/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb:17:in `each'
C:/Documents and Settings/Administrator/puppet/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb:17:in `run'
176 File.expects(:rename).returns(0)
177
178 proc { Puppet::Util::Storage.load() }.should_not raise_error()
179
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.