summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdam Leff <adam@leff.co>2016-06-10 12:11:40 -0400
committerAdam Leff <adam@leff.co>2016-06-10 12:11:46 -0400
commit54ced0da2bd835e3753cbe51e588cf3e8040a6c9 (patch)
tree39b91829e643ae227693ae6666cc6abc738a8fe2 /lib
parent8693be1d64b06b93fb357ac96588b17a6ea64579 (diff)
downloadchef-54ced0da2bd835e3753cbe51e588cf3e8040a6c9.tar.gz
bug fix: correctly write out data collector metadata fileadamleff/node-uuid-fix
When we changed the messages from class instances to a module, the reading of metadata into an instance variable was removed and introduced a bug when updating metadata. This bug causes the metadata to be properly read from disk, updated, but then the metadata from disk is simply re-written to disk without the intended updates.
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/data_collector/messages/helpers.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/chef/data_collector/messages/helpers.rb b/lib/chef/data_collector/messages/helpers.rb
index 3e52f80047..c0c700f847 100644
--- a/lib/chef/data_collector/messages/helpers.rb
+++ b/lib/chef/data_collector/messages/helpers.rb
@@ -148,8 +148,8 @@ class Chef
end
def update_metadata(key, value)
- metadata[key] = value
- Chef::FileCache.store(metadata_filename, metadata.to_json, 0644)
+ updated_metadata = metadata.tap { |x| x[key] = value }
+ Chef::FileCache.store(metadata_filename, updated_metadata.to_json, 0644)
end
def metadata_filename