lib/onering/util.rb in onering-client-0.1.2 vs lib/onering/util.rb in onering-client-0.1.3
- old
+ new
@@ -92,11 +92,20 @@
if defined?(Facter)
if name.downcase == 'all'
return Facter.to_hash
else
- fact = Facter.value(name)
+ case name.to_sym
+ when :hardwareid
+ if File.exists?('/etc/hardware.id')
+ fact = File.read('/etc/hardware.id').lines.first.strip.chomp
+ else
+ fact = Facter.value(name)
+ end
+ else
+ fact = Facter.value(name)
+ end
# short circuit nil responses
return default if fact.nil?
# if we are asking for a nested object...
@@ -137,7 +146,13 @@
end
class Module
def submodules
constants.collect {|const_name| const_get(const_name)}.select {|const| const.class == Module}
+ end
+end
+
+class NilClass
+ def <=>(*args)
+ return 1
end
end
\ No newline at end of file