Skip to content

Commit

Permalink
Run initdb for any redhat-derived platform version on first install
Browse files Browse the repository at this point in the history
This should have been done in the 2012-11-02 commit to "[COOK-1844]
Make service name configurable." That change corrected the initdb
call with the version-specific service name, and it also removed
the comment about the code being not valid for 9.x. It should have
removed the "if node[postgresql][version].to_f < 9.0", too.

That is what I have done, to complete that fix.
  • Loading branch information
davidc-donorschoose authored and jtimberman committed Jan 22, 2013
1 parent db66559 commit d9c1668
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions recipes/server_redhat.rb
Expand Up @@ -44,10 +44,8 @@

end

if node['postgresql']['version'].to_f < 9.0
execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
end
execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
end

service "postgresql" do
Expand Down

3 comments on commit d9c1668

@hoshposh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi,

This change removed the fix that enabled the SuSE platform to work. On the SuSE version of the postgresql-server package the /etc/init.db/postgresql does not have an initdb sub-command. Here is the list of command available:
STDOUT: Usage: /etc/init.d/postgresql {start|stop|status|try-restart|restart|force-reload|reload|probe}

I think placing the following condition around the initdb invocation will suffice:

if node['platform_family'] != "suse"
  execute "/sbin/service #{node['postgresql']['server']['service_name']} initdb" do
    not_if { ::FileTest.exist?(File.join(node['postgresql']['dir'], "PG_VERSION")) }
  end
end

Cheers,
-Lyndon-

@jtimberman
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hoshposh, Sorry about that! Fixed in 05ff11b and will be in the next release.

@hoshposh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, though you might want to consider accepting pull request #51 which seems to address this as well. Anyway, thanks again.

Please sign in to comment.