-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
work around 'Exception::ImmutableAttributeModification' #14
Open
anatolijd
wants to merge
6
commits into
bryanwb:master
Choose a base branch
from
anatolijd:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Running this recipe under Chef-11.8 I get this: ``` 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: --------------- /var/chef/cache/cookbooks/jmxtrans/recipes/default.rb:23:in `block in from_file' /var/chef/cache/cookbooks/jmxtrans/recipes/default.rb:22:in `each' /var/chef/cache/cookbooks/jmxtrans/recipes/default.rb:22:in `from_file' Relevant File Content: ---------------------- /var/chef/cache/cookbooks/jmxtrans/recipes/default.rb: 16: end 17: 18: user node['jmxtrans']['user'] 19: 20: # merge stock jvm queries w/ container specific ones into single array 21: servers = node['jmxtrans']['servers'] 22: servers.each do |server| 23>> server['queries'] = node['jmxtrans']['default_queries']['jvm'] 24: case server['type'] 25: when 'tomcat' 26: server['queries'] << node['jmxtrans']['default_queries']['tomcat'] 27: end 28: server['queries'].flatten! 29: end 30: 31: ark "jmxtrans" do 32: url node['jmxtrans']['url'] ```
node['jmxtrans']['servers'] may already have custom queries defined in attribute. Append default jvm queries to preserve custom ones.
forgot to mention -a fix from PR #13 did not work for me, I get another exception:
I know about collectd jmx plugin, the problem is that it produces 'unfriendly' graphite names for JMX metrics, and even with chain mangling I can't separate GenericJMX-- with '.' (I can, but it gets replaced back by write_graphite plugin ). |
jmxtrans.sh and /etc/init.d/jmxtrans depend on 'source' bashism
next line '<<' operator fails if container does not have any custom query
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Running this recipe under chef-11.8.0 I get this:
Since it is the only place where we refer to node['jmxtrans']['servers'] attribute in recipe - .dup can be used to work it around (I hope).