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-client 12.4.0 wrongly detects sysvinit instead of systemd on CentOS 7 #3593
Comments
Guessing this is due to the change in ordering rules for provider resolution. The fix will probably be in the httpd cookbook, not Chef. |
@ameir what platform(s) are you running on? It looks like the template resource is failing because you're running on enterprise linux 7, the cookbook uses platform version to choose the template source, and doesn't have files for el7. https://github.com/chef-cookbooks/httpd/tree/master/templates/default/2.4/sysvinit |
I'm betting it is because of this https://github.com/chef-cookbooks/httpd/blob/master/libraries/provider_httpd_service_rhel_systemd.rb#L14-L16 Platform should probably be |
@coderanger platform https://github.com/chef/ohai/blob/master/lib/ohai/plugins/linux/platform.rb#L24 |
platform should be
|
@lamont-granquist there's a comment there that it doesn't use platform_family to avoid amazon (chef-boneyard/chef-rfc#109) @someara and @jdmundrawala are replicating the issue now to determine the best place for a fix. |
Hmm, then probably a provider resolver ordering issue, the |
yeah, nm, i just read that. still, |
@ameir it would be useful to get fuller debug logs which include the provider_resolver output for when the Systemd or Sysvinit providers get selected. The debug log for the template resource that fails isn't useful. Although it does look like the platform+platform_version are centos-7.1.1503 based on the template resource output so that's useful. |
So the fix would be to make sure that this is only applied if platform_version < 7: Both providers match on centos, and for some reason the NodeMap stuff is not considering the filter with the block to be of a 'higher priority' and returning it. Which is a bug in core chef AFAIK (probably something that @jkeiser needs to look at). But the problem can be resolved here by making the selection of the provider unambiguous. You always want to select sysvinit on centos/scientific/oracle/redhat where pv < 7.0 and always want to select systemd on those when pv >= 7.0 so that is exactly how the provides lines should be fixed to read. |
In Chef 12.3.0 this code should have also spit out a WARN "ambiguous provider resolution" message. |
Actually there's even better detection of sysvinit vs systemd in Chef 12 that the httpd cookbook should use via supports? code rather than doing pv checks. |
Looking at the debug logs more, I do see that in the run with chef-client 12.4.0, php-fpm indeed used the right provider, but not httpd. That certainly suggests the issue is at the cookbook level, not in chef-client; my apologies. Here are snippets from two runs with two different client versions: With chef-client 12.4.0:
With chef-client 12.2.1:
I'd be happy to provide full debug logs of the two runs via gist or the like. Thanks for looking into this! -Ameir |
I pasted the log output at https://gist.github.com/ameir/1f3af9674cde1a341b95 . Let me know if you need anything else to help debug this. |
I am still traveling, so I haven't read everything here, but core chef is indeed supposed to consider things with blocks to be of higher priority than the same thing without a block. So os: 'linux' do ... end is higher priority than os: 'linux'. However, platform: 'debian' is higher priority than both of them. |
As a short term file you can manually specify the provider: httpd_service '...' do
provider Chef::Provider::HttpdService::Rhel::Systemd
...
end |
Can somebody sanity check: |
@jdmundrawala I concur with your reading, should be |
it looks like changing that fixes the issue on my machine |
Should add a unit test to that. Cookbook should still also get fixed to not be ambiguous. |
Fixed in #3599 |
Thanks for the prompt support, guys! I see that chef-client and the httpd cookbook have been updated, so a big 👍 . |
Yeah this is all fixed or getting fixed and tracked by other bugs, I don't think there's anything more to do in this ticket. |
I was running the httpd cookbook, which has previously worked just fine. Today, though, it wasn't. I thought that someone overwrote a version with bad changes, but I tried the fresh cookbook version from GitHub just to be safe, and had the same issues. I downgraded from chef-client 12.4.0 to 12.2.1 and things began to work just fine. In short, it looks like Ohai or whatever does the init system detection is being thrown off somewhere. Here's a snippet of the logs; I have the entire debug log if needed.
The text was updated successfully, but these errors were encountered: