onering-client 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/onering.rb +1 -1
- data/lib/onering/plugins/reporter.rb +1 -1
- data/lib/onering/util.rb +5 -5
- metadata +1 -1
data/lib/onering.rb
CHANGED
@@ -198,7 +198,7 @@ module Onering
|
|
198
198
|
# this is kinda ugly
|
199
199
|
# because we don't know which property might have an @-prefix, progressively
|
200
200
|
# search through all of them. first non-null match wins
|
201
|
-
parts = field.split('.')
|
201
|
+
parts = field.to_s.split('.')
|
202
202
|
|
203
203
|
# create an array with every component of the path prefixed with the @-symbol, then with
|
204
204
|
# the path as is.
|
data/lib/onering/util.rb
CHANGED
@@ -95,27 +95,27 @@ module Onering
|
|
95
95
|
if name.downcase == 'all'
|
96
96
|
return Facter.to_hash()
|
97
97
|
else
|
98
|
-
|
98
|
+
fact_value = Facter.value(name)
|
99
99
|
|
100
100
|
# short circuit nil responses
|
101
|
-
if
|
101
|
+
if fact_value.nil?
|
102
102
|
return reporter.report().get(name, default)
|
103
103
|
end
|
104
104
|
|
105
105
|
# if we are asking for a nested object...
|
106
106
|
if name.include?('.')
|
107
107
|
# ...and the response IS an object...
|
108
|
-
if
|
108
|
+
if fact_value.is_a?(Hash)
|
109
109
|
# remove the first part and return the rest
|
110
110
|
name = name.sub(/^[^\.]+\./,'')
|
111
|
-
return
|
111
|
+
return fact_value.get(name, default)
|
112
112
|
else
|
113
113
|
# not an object, return default
|
114
114
|
return reporter.report().get(name, default)
|
115
115
|
end
|
116
116
|
else
|
117
117
|
# this is a simple request, return the fact
|
118
|
-
return
|
118
|
+
return fact_value
|
119
119
|
end
|
120
120
|
end
|
121
121
|
end
|