diff options
| author | Josh Cooper <josh@puppetlabs.com> | 2011-04-21 14:37:50 -0700 |
|---|---|---|
| committer | Josh Cooper <josh@puppetlabs.com> | 2011-04-21 14:37:50 -0700 |
| commit | 01f610bb223b435dc52f491260af3ea002930102 (patch) | |
| tree | 93565136d5ef2b4156fdd64476792e441bcfbb4e /lib/puppet/node | |
| parent | ac428b9557e2da251e4b51e48de844833ca0aa2a (diff) | |
| parent | fc66e98b84b9a16728af054485883334a5887cca (diff) | |
Merge branch 'next'
Diffstat (limited to 'lib/puppet/node')
| -rwxr-xr-x | lib/puppet/node/facts.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/puppet/node/facts.rb b/lib/puppet/node/facts.rb index 577b62b62..2ff7156c8 100755 --- a/lib/puppet/node/facts.rb +++ b/lib/puppet/node/facts.rb @@ -61,18 +61,22 @@ class Puppet::Node::Facts def self.from_pson(data) result = new(data['name'], data['values']) - result.timestamp = Time.parse(data['timestamp']) - result.expiration = Time.parse(data['expiration']) + result.timestamp = Time.parse(data['timestamp']) if data['timestamp'] + result.expiration = Time.parse(data['expiration']) if data['expiration'] result end def to_pson(*args) - { - 'expiration' => expiration, - 'name' => name, - 'timestamp' => timestamp, - 'values' => strip_internal, - }.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) end # Add internal data to the facts for storage. |
