sous-chefs/nginx

Upgrading nginx from source do not reload systemd daemon

stuszynski opened this issue · 3 comments

Cookbook version

v8.1.5

Chef-client version

v12.22.5

Platform Details

Distributor ID:	Debian
Description:	Debian GNU/Linux 9.5 (stretch)
Release:	9.5
Codename:	stretch

Scenario:

Compile and upgrade new nginx version by setting new ['nginx']['source']['version'] and ['nginx']['source']['checksum']

Steps to Reproduce:

Set ['nginx']['source']['version'] and ['nginx']['source']['checksum'] and run a chef-client

Expected Result:

Compile new nginx, update systemd configration files and restart to new nginx.

Actual Result:

Nginx has been compiled, systemd service file was updated and nginx has been notified to restart at the end of chef-run. Yet, systemd wasn't reloaded so the old version of nginx has been started.

Recipe: nginx::source
  * template[/lib/systemd/system/nginx.service] action create
    - update content in file /lib/systemd/system/nginx.service from 6ba128 to 234918
    --- /lib/systemd/system/nginx.service	2018-10-21 14:38:45.022058175 +0000
    +++ /lib/systemd/system/.chef-nginx20190117-21117-1akgcl8.service	2019-01-17 11:48:17.624361418 +0000
    @@ -3,8 +3,8 @@
     After=network.target remote-fs.target nss-lookup.target

     [Service]
    -ExecStartPre=/opt/nginx-1.14.0/sbin/nginx -t
    -ExecStart=/opt/nginx-1.14.0/sbin/nginx
    +ExecStartPre=/opt/nginx-1.14.2/sbin/nginx -t
    +ExecStart=/opt/nginx-1.14.2/sbin/nginx
     ExecReload=/bin/kill -s HUP $MAINPID
     ExecStop=/bin/kill -s QUIT $MAINPID
     PrivateTmp=true
  * service[nginx] action start (up to date)
  * service[nginx] action enable (up to date)

[other resources]

Recipe: nginx::source
  * service[nginx] action restart
    - restart service service[nginx]
~ systemctl status nginx
Warning: nginx.service changed on disk. Run 'systemctl daemon-reload' to reload units

Maybe this would be a good point to begin with

#478

@GianlucaRizzo I just merged #475 before I saw your PR. Can you check and tell me if it resolves the issue for you? Can you think of any situation where your PR in #478 would act differently than #475?

Closed via #478