Per subject, using Chef 0.9.8. I’m a bit miffed.
script “wait for pgsql startup” do
interpreter "bash"
user “postgres"
group “postgres"
path [”#{node[:postgresql90][:pgbin]}”, “/bin”, “/usr/bin”]
code <<-EOH
retries=0
while (( retries < 10 )); do
if psql -U postgres template1 </dev/null ; then
exit 0
fi
retries=(( retries + 1 ))
sleep 1
done
exit 1
EOH
action :nothing
end
service “postgresql-9.0” do
action [ :enable, :start ]
notifies :run, “script[wait for pgsql startup]”, :immediate
end
… other things happening below here need the database to be actually
available
…to follow up a bit, explicitly specifying “provider
Chef::Resource::Script::Bash” results in the following:
/usr/lib/ruby/gems/1.8/gems/chef-0.9.8/bin/…/lib/chef/resource.rb:84:in
method_missing': undefined method
load_current_resource’ for
Chef::Resource::Bash (NoMethodError)
On Sun, Feb 6, 2011 at 2:27 AM, Charles Duffy charles@dyfis.net wrote:
Per subject, using Chef 0.9.8. I’m a bit miffed.
script “wait for pgsql startup” do
interpreter "bash"
user “postgres"
group “postgres"
path [”#{node[:postgresql90][:pgbin]}”, “/bin”, “/usr/bin”]
code <<-EOH
retries=0
while (( retries < 10 )); do
if psql -U postgres template1 </dev/null ; then
exit 0
fi
retries=(( retries + 1 ))
sleep 1
done
exit 1
EOH
action :nothing
end
service “postgresql-9.0” do
action [ :enable, :start ]
notifies :run, “script[wait for pgsql startup]”, :immediate
end
… other things happening below here need the database to be actually
available
Ugh. Realized my client was on Chef 0.9.8.
Sorry 'bout the noise, y’all.