Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Chef-Solo loads configurations twice #6375
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.
We were able to replicate this for versions 12.14.89+
Red Hat Enterprise Linux Server release 6.8 (Santiago)
The converge_start event handler is run twice, resulting in the statement "Ohai! I have started a converge" being printed twice.
When the chef-solo executable is run, it first loads the configurations in its run method, here : -
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 : -
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 : -
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.
confirmed that the somewhat convoluted code where Chef::Application::Solo#run calls Chef::Application::Client#run is what is responsible.