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

On Debian Jessie service reload fails due to not supported reload method #15

Closed
kleini opened this Issue Jul 15, 2015 · 8 comments

Comments

Projects
None yet
2 participants
@kleini
Copy link

kleini commented Jul 15, 2015

   Recipe: dovecot::service


       ================================================================================
       Error executing action `reload` on resource 'service[dovecot]'
       ================================================================================

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       Expected process to exit with [0], but received '3'
       ---- Begin output of /bin/systemctl reload dovecot ----
       STDOUT: 
       STDERR: Failed to reload dovecot.service: Job type reload is not applicable for unit dovecot.service.
       ---- End output of /bin/systemctl reload dovecot ----
       Ran /bin/systemctl reload dovecot returned 3

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cookbooks/dovecot/recipes/service.rb

        22: service 'dovecot' do
        23:   supports restart: true, reload: true, status: true
        24:   if node['platform'] == 'ubuntu' &&
        25:      Gem::Version.new(node['platform_version']) >= Gem::Version.new('13.10')
        26:     provider Chef::Provider::Service::Upstart
        27:   end
        28:   action [:enable, :start]

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cookbooks/dovecot/recipes/service.rb:22:in `from_file'

       service("dovecot") do
     action [:enable, :start]
         updated true
     supports {:restart=>true, :reload=>true, :status=>true}
         retries 0
         retry_delay 2

         service_name "dovecot"
     enabled true
         running true
     pattern "dovecot"
         declared_type :service
     cookbook_name :dovecot
         recipe_name "service"



     * service[postfix] action restart
       - restart service service[postfix]

   Running handlers:
   [2015-07-15T15:06:07+00:00] ERROR: Running exception handlers
   Running handlers complete
   [2015-07-15T15:06:07+00:00] ERROR: Exception handlers complete
   Chef Client failed. 205 resources updated in 603.232018269 seconds
   [2015-07-15T15:06:07+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
   [2015-07-15T15:06:07+00:00] ERROR: service[dovecot] (dovecot::service line 22) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '3'
   ---- Begin output of /bin/systemctl reload dovecot ----
   STDOUT: 
   STDERR: Failed to reload dovecot.service: Job type reload is not applicable for unit dovecot.service.
   ---- End output of /bin/systemctl reload dovecot ----
   Ran /bin/systemctl reload dovecot returned 3
   [2015-07-15T15:06:07+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

Converge failed on instance .
Please see .kitchen/logs/default-debian-80.log for more details
------Exception-------
Class: Kitchen::ActionFailed
Message: SSH exited (1) for command: [sh -c '

sudo -E /opt/chef/bin/chef-solo --config /tmp/kitchen/solo.rb --log_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json
']


The dovecot packages on Debian Jessie do not seem to provide a systemd unit script. Instead systemd does a fallback to the LSB init scripts. This fallback seems to fail for the "reload" action.

Is there a possibility to disable the reload action of the dovecot service?

@kleini

This comment has been minimized.

Copy link
Author

kleini commented Jul 15, 2015

root@singlenode:/home/debian# /bin/systemctl reload dovecot
Failed to reload dovecot.service: Job type reload is not applicable for unit dovecot.service.

@zuazo

This comment has been minimized.

Copy link
Owner

zuazo commented Jul 15, 2015

@kleini, thanks for the report.

I think we should disable it in that distribution version. Give me a couple of days, because there are no tests for that version.

@zuazo zuazo added the bug label Jul 15, 2015

@zuazo zuazo self-assigned this Jul 15, 2015

@kleini

This comment has been minimized.

Copy link
Author

kleini commented Jul 16, 2015

Can you give me some hint how to solve that on my own? I tried to disable the reload support in the service but this does not seem to be sufficient:

service 'dovecot' do
  if node['platform'] == 'debian' && Gem::Version.new(node['platform_version']) >= Gem::Version.new('8.0') && Gem::Version.new(node['platform_version']) < Gem::Version.new('9.0')
    supports :status => true, :restart => true, :reload => false
  else
    supports :status => true, :restart => true, :reload => true
  end
  if node['platform'] == 'ubuntu' &&
     Gem::Version.new(node['platform_version']) >= Gem::Version.new('13.10')
    provider Chef::Provider::Service::Upstart
  end
  action [:enable, :start]
end
@kleini

This comment has been minimized.

Copy link
Author

kleini commented Jul 16, 2015

As a workaround I used now the systemd unit file for Fedora https://github.com/ioanrogers/systemd-units/blob/master/system/dovecot.service and put this into the system before installing dovecot.

@zuazo

This comment has been minimized.

Copy link
Owner

zuazo commented Jul 16, 2015

@kleini something seems to be wrong with the Service#supports method. It does not work properly since the refactoring.

Thanks for the information, I'm going to try to fix the systemd script based on this Fedora example.

@zuazo

This comment has been minimized.

Copy link
Owner

zuazo commented Jul 22, 2015

Fix released in 2.2.0.

@kleini

This comment has been minimized.

Copy link
Author

kleini commented Sep 8, 2015

The fix works for me.

@zuazo

This comment has been minimized.

Copy link
Owner

zuazo commented Sep 8, 2015

Nice @kleini! Thanks for the feedback 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.