I'm writing a Chef recipe to install among other things nginx and Phusion Passenger. The short summary is that the recipes on my run list are not executing in the order I expect, and that's causing an apt package installation to fail in a way I don't know how to fix. The full sequence is a little complicated, I'll do my best to keep to the essential details.
I have my own recipe,
lr-web for customising the web server to the state I want it to be in. One of its actions to make changes to
nginx.conf. I also have a role to orchestrate the overall configuration, whose run list is:
"run_list":[ "recipe[apt]", "recipe[nginx]", "recipe[passenger]", "recipe[lr-web]" ]
lr-web recipe lists
nginx as dependencies in its
nginx recipes are the standard OpsCode ones. But I've written my own
passenger recipe, as the OpsCode one uses rubygems to install passenger, but that version is no longer supported. Following the advice on modrails.com to install via apt, I have the following steps in my
cookbook_file "/etc/apt/sources.list.d/passenger.list" do source "passenger.list" mode 600 action :create_if_missing end bash "apt-get-update" do user "root" code <<-EOF apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7 apt-get install apt-transport-https ca-certificates apt-get update EOF end apt_package "nginx-extras" do action :install end
What happens when I converge the node is that I get a prompt from apt-get, even though it passes the
-y flag because the
nginx-extras package installer doesn't want to overwrite
Configuration file `/etc/nginx/nginx.conf' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** nginx.conf (Y/I/N/O/D/Z) [default=N] ? Configuration file `/etc/nginx/sites-available/default' ==> Modified (by you or by a script) since installation. ==> Package distributor has shipped an updated version. What would you like to do about it ? Your options are: Y or I : install the package maintainer's version N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** default (Y/I/N/O/D/Z) [default=N] ? dpkg: error processing nginx-common (--configure): EOF on stdin at conffile prompt dpkg: dependency problems prevent configuration of nginx-extras: nginx-extras depends on nginx-common (= 1:1.4.4-220.127.116.11~precise1); however: Package nginx-common is not configured yet. dpkg: error processing nginx-extras (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: nginx-common nginx-extras E: Sub-process /usr/bin/dpkg returned an error code (1)
As far as I can tell, the only way this can be happening is if my
lr-web recipe is run before the passenger recipe, which it shouldn't do.
So. The problem I have is that
lr-web is running before
passenger, and thus change the nginx conf. I either need to find out why that's happening, and stop it, or find a way when
apt_package is installing
nginx-extras to pass the 'N' response saying "don't overwrite the nginx.conf". Any suggestions on either angle of attack would be very welcome.