Closed lanejlanej closed 9 years ago
If I try this on a vanilla system and exclude the additional config file element it fails to start the service instead:
/bin/systemctl restart httpd-default returned 6, expected 0
When the above command is run manually: [root@ip-172-31-17-150 chef]# /bin/systemctl restart httpd-default Failed to issue method call: Unit httpd-default.service failed to load: No such file or directory.
I can't seem to reproduce this.
Here's a test cookbook:
And serverspec:
Perhaps your template source has an error in it?
-s
Hi Sean, Thanks for looking in to this. Please go ahead and close this issue, as I can't reproduce the config file error in a stripped down environment. However, I am still seeing the following error:
restart
on resource 'httpd_service[default]'Chef::Exceptions::Exec
----------------------
service[default :restart httpd-default] (/var/chef/cache/cookbooks/httpd/libraries/provider_httpd_service_rhel_systemd.rb line 74) had an error: Chef::Exceptions::Exec: /bin/systemctl restart httpd-default returned 6, expected 0
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/testbook/recipes/default.rb
76: httpd_service 'default' do
77: action :create
78: keepalive true
79: keepalivetimeout '5'
80: maxkeepaliverequests '500'
81: mpm 'prefork'
82: version '2.4'
83: listen_ports [ '80' ]
84: log_level 'warn'
85: end
86:
As there is no systemd service defined called httpd-default.service.
Do you want me to raise a separate issue for this?
Regard
John
If the following change is made to provider_httpd_service_rhel_systemd.rb 18c18
action :create do
things get a little further. ie. the sytemd config files are created etc. But, now the only content in /etc/httpd-default is conf.modules.d. And, the /usr/sbin/httpd-default link doesn't exist. Presumably because the :create action in the super class is getting run after the :create action in provider_httpd_service_rhel_systemd.rb.
apologie, for formatting above... github magic.
Sorry, realise how it is meant to work now, so flipped the action: statement above back to original, and put this in the recipe service entry
action [ :create, :start ]
Now, everything looks as it should. (But had to issue 'systemctl daemon-reload' to get the new service recognised).
BTW it still fails, as it isn't finding an MPM to use, but that is probably something in my config.
Apologies for wasting your time. But, have been pulling my hair out a bit about this.
Tiny bit of added value from me.
Added execute "/bin/systemctl daemon-reload"
at line 56 in provider_httpd_service_rhel_systemd.rb
and all works perfectly.
I still can't reproduce this... can you gist your entire recipe?
On Fri, Feb 13, 2015 at 9:31 AM, John Lane notifications@github.com wrote:
Tiny bit of added value from me.
Added execute "/bin/systemctl daemon-reload"
at line 56 in provider_httpd_service_rhel_systemd.rb
and all works perfectly.
— Reply to this email directly or view it on GitHub https://github.com/chef-cookbooks/httpd/issues/24#issuecomment-74261517.
Hi Sean,
Gist at https://gist.github.com/lanejlanej/ad15b6e5bcfdfa73dd02
It may be something peculiar to my install of centos, but it seems to need that reload of the daemon to start (but not always, I think) or reload httpd-default.
Thanks for your help.
Regards
John
On Fri, Feb 13, 2015 at 2:44 PM, Sean OMeara notifications@github.com wrote:
I still can't reproduce this... can you gist your entire recipe?
On Fri, Feb 13, 2015 at 9:31 AM, John Lane notifications@github.com wrote:
Tiny bit of added value from me.
Added execute "/bin/systemctl daemon-reload"
at line 56 in provider_httpd_service_rhel_systemd.rb
and all works perfectly.
— Reply to this email directly or view it on GitHub <https://github.com/chef-cookbooks/httpd/issues/24#issuecomment-74261517 .
— Reply to this email directly or view it on GitHub https://github.com/chef-cookbooks/httpd/issues/24#issuecomment-74263522.
Hi Sean, I will close this. I have worked out what was causing the problem. On my test runs I had been neglecting to delete /etc/systemd/system/multi-user.target.wants/httpd-default.service. As a consequence, I imagine, Chef said 'ah already a symlink in place, don't need to run "systemctl enable httpd-default" ' which means that the configuration doesn't get reloaded. So, my mistake. All works perfectly, sorry to have led you on wild goose chase.
I tried switching up from version 0.1.5 to 0.2.6, and encountered a problem, with config file creation.
The resource in the recipe is as follows (which works with 0.1.5):
httpd_config 'drupal' do config_name 'drupal' instance 'default' source "drupal-web-env.conf.erb" action :create notifies :restart, 'httpd_service[default]' end
When this runs an /etc/http-default/conf.d directory is created, but the drupal.conf file is empty.
(up to date) * template[drupal :create /etc/httpd-default/conf.d/drupal.conf] action create[2015-02-12T14:28:52+00:00] INFO: Processing template[drupal :create /etc/httpd-default/conf.d/drupal.conf] action create (/var/chef/cache/cookbooks/httpd/libraries/provider_httpd_config_rhel.rb line 28) [2015-02-12T14:28:52+00:00] INFO: template[drupal :create /etc/httpd-default/conf.d/drupal.conf] created file /etc/httpd-default/conf.d/drupal.conf
I am not in a position to debug right now, as I had to switch back.