From 66b035d9f628371562551a4161f4117ad06993aa Mon Sep 17 00:00:00 2001 From: jtimberman Date: Thu, 3 Jun 2010 01:40:18 -0400 Subject: [PATCH] COOK-286, platform specific version as set_unless for postgresql --- postgresql/attributes/default.rb | 25 +++++++++++++++++-- postgresql/metadata.json | 43 ++++++++++++-------------------- postgresql/metadata.rb | 10 ++------ postgresql/recipes/server.rb | 2 +- 4 files changed, 42 insertions(+), 38 deletions(-) diff --git a/postgresql/attributes/default.rb b/postgresql/attributes/default.rb index fed13ea44..1ec15c62d 100644 --- a/postgresql/attributes/default.rb +++ b/postgresql/attributes/default.rb @@ -17,11 +17,32 @@ # limitations under the License. # +set_unless[:postgresql][:version] = value_for_platform( + "ubuntu" => { + "8.04" => "8.3", + "8.10" => "8.3", + "9.10" => "8.3", + "10.04" => "8.4", + "default" => "8.4" + }, + "fedora" => { + "10" => "8.3", + "11" => "8.3", + "12" => "8.3", + "13" => "8.4", + "14" => "8.4", + "default" => "8.4" + }, + ["redhat", "centos"] => { + "default" => "8.3" + } +) + case platform when "redhat","centos","fedora","suse" set[:postgresql][:dir] = "/var/lib/pgsql/data" when "debian","ubuntu" - set[:postgresql][:dir] = "/etc/postgresql/8.3/main" + set[:postgresql][:dir] = "/etc/postgresql/#{node.postgresql.version}/main" else - set[:postgresql][:dir] = "/etc/postgresql/8.3/main" + set[:postgresql][:dir] = "/etc/postgresql/#{node.postgresql.version}/main" end diff --git a/postgresql/metadata.json b/postgresql/metadata.json index ba3420829..2cd9f3219 100644 --- a/postgresql/metadata.json +++ b/postgresql/metadata.json @@ -1,22 +1,7 @@ { - "maintainer": "Opscode, Inc.", - "attributes": { - "postgresql/dir": { - "default": "/etc/postgresql/8.3/main", - "calculated": false, - "type": "string", - "choice": [ - - ], - "description": "Location of the PostgreSQL databases", - "display_name": "PostgreSQL Directory", - "required": "optional", - "recipes": [ - - ] - } + "replacing": { }, - "suggestions": { + "attributes": { }, "platforms": { "ubuntu": [ @@ -24,6 +9,9 @@ ], "rhel": [ + ], + "fedora": [ + ], "centos": [ @@ -32,26 +20,27 @@ ] }, + "groupings": { + }, "dependencies": { }, - "maintainer_email": "cookbooks@opscode.com", - "conflicting": { + "long_description": "= DESCRIPTION:\n\nInstalls and configures postgresql client or server.\n\n= REQUIREMENTS:\n\n== Platform:\n\nTested on Ubuntu 8.10, but adapted from Red Hat Enterprise 5.0 based recipes.\n\n== Cookbooks:\n\n= ATTRIBUTES: \n\n* postgresql[:dir] - configuration file location.\n\n= USAGE:\n\nFor clients:\n\n include_recipe \"postgresql::client\"\n \nFor server: \n\n include_recipe \"postgresql::server\"\n \n(client is already included by server)\n\n= LICENSE and AUTHOR:\n \nAuthor:: Joshua Timberman ()\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", + "recommendations": { }, - "version": "0.8.0", + "version": "0.9.0", + "maintainer": "Opscode, Inc.", "name": "postgresql", + "suggestions": { + }, "recipes": { "postgresql::server": "Installs postgresql server packages, templates", "postgresql::client": "Installs postgresql client package(s)" }, - "providing": { - }, "license": "Apache 2.0", - "replacing": { - }, - "groupings": { + "maintainer_email": "cookbooks@opscode.com", + "conflicting": { }, - "long_description": "= DESCRIPTION:\n\nInstalls and configures postgresql client or server.\n\n= REQUIREMENTS:\n\n== Platform:\n\nTested on Ubuntu 8.10, but adapted from Red Hat Enterprise 5.0 based recipes.\n\n== Cookbooks:\n\n= ATTRIBUTES: \n\n* postgresql[:dir] - configuration file location.\n\n= USAGE:\n\nFor clients:\n\n include_recipe \"postgresql::client\"\n \nFor server: \n\n include_recipe \"postgresql::server\"\n \n(client is already included by server)\n\n= LICENSE and AUTHOR:\n \nAuthor:: Joshua Timberman ()\n\nCopyright:: 2009, Opscode, Inc\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n", - "recommendations": { + "providing": { }, "description": "Installs and configures postgresql for clients or servers" } \ No newline at end of file diff --git a/postgresql/metadata.rb b/postgresql/metadata.rb index cee305440..efd09e2bf 100644 --- a/postgresql/metadata.rb +++ b/postgresql/metadata.rb @@ -3,16 +3,10 @@ license "Apache 2.0" description "Installs and configures postgresql for clients or servers" long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) -version "0.8" +version "0.9" recipe "postgresql::client", "Installs postgresql client package(s)" recipe "postgresql::server", "Installs postgresql server packages, templates" -%w{rhel centos ubuntu debian}.each do |os| +%w{rhel centos fedora ubuntu debian}.each do |os| supports os end - -attribute "postgresql/dir", - :display_name => "PostgreSQL Directory", - :description => "Location of the PostgreSQL databases", - :default => "/etc/postgresql/8.3/main" - diff --git a/postgresql/recipes/server.rb b/postgresql/recipes/server.rb index 75ada225e..130971e15 100644 --- a/postgresql/recipes/server.rb +++ b/postgresql/recipes/server.rb @@ -24,7 +24,7 @@ service "postgresql" do case node[:platform] when "debian","ubuntu" - service_name "postgresql-8.3" + service_name "postgresql-#{node.postgresql.version}" end supports :restart => true, :status => true, :reload => true action :nothing