Skip to content
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

Content accumulator guard #57

Merged
merged 1 commit into from
Oct 22, 2015

Conversation

jtimberman
Copy link
Contributor

Because of the way we manipulate run contexts in resources, and resource
event notifications, we need to ensure that we aren't accumulating the
configuration file content multiple times when the add_config method
is used.

Because of the way we manipulate run contexts in resources, and resource
event notifications, we need to ensure that we aren't accumulating the
configuration file content multiple times when the `add_config` method
is used.
@schisamo
Copy link
Contributor

👍

jtimberman added a commit that referenced this pull request Oct 22, 2015
…rendered-twice

Content accumulator guard
@jtimberman jtimberman merged commit 23d30f1 into master Oct 22, 2015
@jtimberman jtimberman deleted the jtimberman/config-content-rendered-twice branch October 22, 2015 15:54
@@ -127,7 +127,7 @@ def add_config(product, content)
# foodcritic thinks we are accessing a node attribute
node.run_state[:ingredient_config_data] ||= {} # ~FC001
node.run_state[:ingredient_config_data][product] ||= '' # ~FC001
node.run_state[:ingredient_config_data][product] += content # ~FC001
node.run_state[:ingredient_config_data][product] += content unless node.run_state[:ingredient_config_data][product].include?(content) # ~FC001
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read this as we only allow recipes to set the content data for a product once during a client run. Would it be better to raise an exception (or at least a warning) so it doesn't silently bypass?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants