summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-04-21 16:56:03 -0700
committerMax Martin <max@puppetlabs.com>2011-04-21 17:20:28 -0700
commit2a2226c0b71aafcda953057d3ecc8df5638447f2 (patch)
tree956b8923f01a5b39cb3f9fc84aedb1a823b76bc1 /lib/puppet
parentaaf7e2300b12a0ef03b620efc5eea7af0dc6f71b (diff)
downloadpuppet-2a2226c0b71aafcda953057d3ecc8df5638447f2.tar.gz
puppet-2a2226c0b71aafcda953057d3ecc8df5638447f2.tar.xz
puppet-2a2226c0b71aafcda953057d3ecc8df5638447f2.zip
Revert "Fixing Facts pson methods more resilient"
This reverts commit 07a7a68a25eb9b21189751c27f90f972224ea533. The JSON patch series has caused problems with the inventory service, and further discussion is needed to decide how to serialize objects to PSON with regards to future compatibility. Conflicts: spec/unit/node/facts_spec.rb Paired-with:Matt Robinson <matt@puppetlabs.com>
Diffstat (limited to 'lib/puppet')
-rwxr-xr-xlib/puppet/node/facts.rb20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb
index 2ff7156c8..577b62b62 100755
--- a/lib/puppet/node/facts.rb
+++ b/lib/puppet/node/facts.rb
@@ -61,22 +61,18 @@ class Puppet::Node::Facts
def self.from_pson(data)
result = new(data['name'], data['values'])
- result.timestamp = Time.parse(data['timestamp']) if data['timestamp']
- result.expiration = Time.parse(data['expiration']) if data['expiration']
+ result.timestamp = Time.parse(data['timestamp'])
+ result.expiration = Time.parse(data['expiration'])
result
end
def to_pson(*args)
- result = {
- 'document_type' => "Puppet::Node::Facts",
- 'data' => {}
- }
-
- result['data']['name'] = name
- result['data']['expiration'] = expiration if expiration
- result['data']['timestamp'] = timestamp if timestamp
- result['data']['values'] = strip_internal
- result.to_pson(*args)
+ {
+ 'expiration' => expiration,
+ 'name' => name,
+ 'timestamp' => timestamp,
+ 'values' => strip_internal,
+ }.to_pson(*args)
end
# Add internal data to the facts for storage.