Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[datadog_monitor] Fix crash for jmx integrations with init_config att…
…ributes set (#869) Fixes a crash when the init_config attribute for a jmx integration (such asignite, jboss_wildfly) is set. Previously, the init_config attribute would be merged in-place (through the merge! method) with another hash: { 'is_jmx': true, 'collect_default_metrics': true }. This would cause a crash if init_config is defined in attributes, because chef attributes cannot be modified that way: ================================================================================ Error executing action `add` on resource 'datadog_monitor[jboss_wildfly]' ================================================================================ Chef::Exceptions::ImmutableAttributeModification ------------------------------------------------ Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"' Cookbook Trace: (most recent call first) ---------------------------------------- /tmp/kitchen/cache/cookbooks/datadog/resources/monitor.rb:67:in `block (2 levels) in class_from_file' /tmp/kitchen/cache/cookbooks/datadog/resources/monitor.rb:43:in `block in class_from_file' This PR fixes this by not merging the attributes in-place. It also adds a kitchen test which exhibits the previous faulty behavior.
- Loading branch information