-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Chef-Solo loads configurations twice #6375
Comments
confirmed that the somewhat convoluted code where Chef::Application::Solo#run calls Chef::Application::Client#run is what is responsible. the initial |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
chef-solo run loads the configuration file (solo.rb) twice when it's run. This causes duplication of handlers, resulting in the same handler being run twice.
Chef Version
We were able to replicate this for versions 12.14.89+
Platform Version
Red Hat Enterprise Linux Server release 6.8 (Santiago)
Replication Case
Solo Output
The converge_start event handler is run twice, resulting in the statement "Ohai! I have started a converge" being printed twice.
My Analysis
When the chef-solo executable is run, it first loads the configurations in its run method, here : -
https://github.com/chef/chef/blob/master/lib/chef/application/solo.rb#L222
If the legacy mode flag is not passed to the chef-solo run, then this block of code is executed later on in the run method : -
https://github.com/chef/chef/blob/master/lib/chef/application/solo.rb#L225
This calls the run method of the application class, which calls reconfiguration method again, so the configuration file is loaded for the second time here : -
https://github.com/chef/chef/blob/master/lib/chef/application.rb#L57
This is fine for configurations like checksum_path, cookbook_path etc. as they are overwritten with the same value, but for chef-handlers (start_handlers, report_handlers, exception_handlers, event_handler), which are stored as arrays, it results in two similar objects getting inserted, which causes this problem.
The text was updated successfully, but these errors were encountered: