voxpupuli / puppet-nginx

Puppet Module to manage NGINX on various UNIXes
https://forge.puppet.com/puppet/nginx
MIT License
470 stars 881 forks source link

Circuler dependency #656

Closed b4ldr closed 8 years ago

b4ldr commented 9 years ago

I have just started to use this module on freebsd and have noticed a circuler dependency. On FreeBSD the log dir /var/log/nginx/ does not exist so trying to start the service fails and the first (and susequent) puppet runs fail with the following error

Error: Could not start Service[nginx]: Execution of '/usr/local/etc/rc.d/nginx onestart' returned 1: Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/var/log/nginx/error.log" failed (2: No such file or directory)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
Starting nginx.
nginx: [emerg] open() "/var/log/nginx/error.log" failed (2: No such file or directory)
/usr/local/etc/rc.d/nginx: WARNING: failed to start nginx
Error: /Stage[main]/Nginx::Service/Service[nginx]/ensure: change from stopped to running failed: Could not start Service[nginx]: Execution of '/usr/local/etc/rc.d/nginx onestart' returned 1: Performing sanity check on nginx configuration:
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: [emerg] open() "/var/log/nginx/error.log" failed (2: No such file or directory)
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
Starting nginx.
nginx: [emerg] open() "/var/log/nginx/error.log" failed (2: No such file or directory)
/usr/local/etc/rc.d/nginx: WARNING: failed to start nginx

The directory is created[1] however the package installation is set to notify the service[2] and the config class depends on the package instalation[3] and so we never get to create the logdir. I will send a patch to remove the notiofy. I think this is safe as a) the pakage should take care of restarting the service; b) its probably best to only start the service are config class has been run.

[1]https://github.com/jfryman/puppet-nginx/blob/master/manifests/config.pp#L212-214 [2]https://github.com/jfryman/puppet-nginx/blob/master/manifests/init.pp#L216 [3]https://github.com/jfryman/puppet-nginx/blob/master/manifests/init.pp#L289

3flex commented 8 years ago

Closing for now. If we get more information we can reopen. Thanks!