From fd07a04dd1c5479cdd0a2818496fa5f54dde99c1 Mon Sep 17 00:00:00 2001 From: Chen Zhiwei Date: Wed, 4 Dec 2013 22:05:32 -0500 Subject: [PATCH] Add DB2 support to glance on redhat platform Add a new attribute default["openstack"]["image"]["platform"]["db2_python_packages"] and fix an attribute typo in registry recipe Change-Id: Ic84eefd460d1117c60570394e3b402a09a0e3016 Implements: blueprint db2-support --- Berksfile.lock | 10 +++++----- Gemfile.lock | 2 +- README.md | 3 +++ attributes/default.rb | 1 + recipes/registry.rb | 2 +- spec/registry-redhat_spec.rb | 11 +++++++++++ 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/Berksfile.lock b/Berksfile.lock index fd4723b..f2906a7 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -14,13 +14,13 @@ "ref": "2201bd113ffe1742c19811aa4df59a5790af71e3" }, "apt": { - "locked_version": "2.1.1" + "locked_version": "2.3.0" }, "database": { - "locked_version": "1.5.2" + "locked_version": "1.4.0" }, "mysql": { - "locked_version": "3.0.4" + "locked_version": "3.0.0" }, "openssl": { "locked_version": "1.1.0" @@ -29,10 +29,10 @@ "locked_version": "1.4.2" }, "postgresql": { - "locked_version": "3.1.0" + "locked_version": "3.3.4" }, "aws": { - "locked_version": "0.101.6" + "locked_version": "1.0.0" }, "xfs": { "locked_version": "1.1.0" diff --git a/Gemfile.lock b/Gemfile.lock index 30830d8..6afd4ee 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -62,7 +62,7 @@ GEM erubis (2.7.0) faraday (0.8.8) multipart-post (~> 1.2.0) - fauxhai (2.0.0) + fauxhai (2.0.1) net-ssh ohai ffi (1.9.3) diff --git a/README.md b/README.md index a787ce8..40d7449 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,8 @@ Attributes for the Image service are in the ['openstack']['image'] namespace. * `openstack['image']['api']['rbd']['rbd_store_pool']` - RADOS pool for images * `openstack['image']['api']['rbd']['rbd_store_chunk_size']` - Size in MB of chunks for RADOS Store, should be a power of 2 * `openstack['image']['cron']['redirection']` - Redirection of cron output +TODO: Add DB2 support on other platforms +* `openstack['image']['platform']['db2_python_packages']` - Array of DB2 python packages, only available on redhat platform MQ attributes @@ -171,6 +173,7 @@ Author:: Craig Tracey () Author:: Sean Gallagher () Author:: Mark Vanderwiel () Author:: Salman Baset () +Author:: Chen Zhiwei (zhiwchen@cn.ibm.com) Copyright 2012, Rackspace US, Inc. Copyright 2012-2013, Opscode, Inc. diff --git a/attributes/default.rb b/attributes/default.rb index 0692ace..fb54e37 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -150,6 +150,7 @@ when "fedora", "redhat", "centos" # :pragma-foodcritic: ~FC024 - won't fix this default["openstack"]["image"]["platform"] = { "postgresql_python_packages" => [ "python-psycopg2" ], "mysql_python_packages" => [ "MySQL-python" ], + "db2_python_packages" => ["db2-odbc", "python-ibm-db", "python-ibm-db-sa"], "image_packages" => [ "openstack-glance", "cronie", "python-glanceclient"], "image_client_packages" => ["python-glanceclient"], "swift_packages" => [ "openstack-swift" ], diff --git a/recipes/registry.rb b/recipes/registry.rb index 89e8620..b27e998 100644 --- a/recipes/registry.rb +++ b/recipes/registry.rb @@ -45,7 +45,7 @@ package "curl" do action :install end -db_type = node['openstack']['db']['identity']['db_type'] +db_type = node['openstack']['db']['image']['db_type'] pkg_key = "#{db_type}_python_packages" if platform_options.has_key?(pkg_key) platform_options[pkg_key].each do |pkg| diff --git a/spec/registry-redhat_spec.rb b/spec/registry-redhat_spec.rb index b7d2d61..e3f3060 100644 --- a/spec/registry-redhat_spec.rb +++ b/spec/registry-redhat_spec.rb @@ -19,6 +19,17 @@ describe "openstack-image::registry" do expect(@chef_run).to install_package "MySQL-python" end + it "installs db2 python packages if explicitly told" do + chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS + node = chef_run.node + node.set["openstack"]["db"]["image"]["db_type"] = "db2" + chef_run.converge "openstack-image::registry" + + ["db2-odbc", "python-ibm-db", "python-ibm-db-sa"].each do |pkg| + expect(chef_run).to install_package pkg + end + end + it "installs glance packages" do expect(@chef_run).to upgrade_package "openstack-glance" expect(@chef_run).to upgrade_package "cronie"