Adding guard around deleting sqlite db

* Don't delete if node.openstack.db.image.db_type is set to sqlite

Fixes: bug #1249182
Change-Id: I5ab84df0eac6d4642476d9c19dbfdbbb473b42bf
This commit is contained in:
galstrom21 2013-11-13 15:40:34 -06:00
parent fbe499f4a4
commit f9a788045c
4 changed files with 16 additions and 1 deletions

View File

@ -2,6 +2,10 @@
This file is used to list changes made in each version of cookbook-openstack-image. This file is used to list changes made in each version of cookbook-openstack-image.
## 7.0.6
### Bug
* Do not delete the sqlite database layed down by the glance packages when node.openstack.db.image.db_type is set to sqlite.
## 7.0.5: ## 7.0.5:
* Allow swift packages to be optionally installed. * Allow swift packages to be optionally installed.

View File

@ -3,7 +3,7 @@ maintainer "Opscode, Inc."
license "Apache 2.0" license "Apache 2.0"
description "Installs and configures the Glance Image Registry and Delivery Service" description "Installs and configures the Glance Image Registry and Delivery Service"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "7.0.5" version "7.0.6"
recipe "openstack-image::api", "Installs packages required for a glance api server" recipe "openstack-image::api", "Installs packages required for a glance api server"
recipe "openstack-image::registry", "Installs packages required for a glance registry server" recipe "openstack-image::registry", "Installs packages required for a glance registry server"
recipe "openstack-image::identity_registration", "Registers Glance endpoints and service with Keystone" recipe "openstack-image::identity_registration", "Registers Glance endpoints and service with Keystone"

View File

@ -83,6 +83,7 @@ end
file "/var/lib/glance/glance.sqlite" do file "/var/lib/glance/glance.sqlite" do
action :delete action :delete
not_if { node["openstack"]["db"]["image"]["db_type"] == "sqlite" }
end end
directory "/etc/glance" do directory "/etc/glance" do

View File

@ -68,6 +68,16 @@ describe "openstack-image::registry" do
expect(@chef_run).to delete_file "/var/lib/glance/glance.sqlite" expect(@chef_run).to delete_file "/var/lib/glance/glance.sqlite"
end end
it "does not delete glance.sqlite when configured to use sqlite" do
opts = ::UBUNTU_OPTS.merge(:evaluate_guards => true)
chef_run = ::ChefSpec::ChefRunner.new opts
node = chef_run.node
node.set["openstack"]["db"]["image"]["db_type"] = "sqlite"
chef_run.stub_command("glance-manage db_version", true)
chef_run.converge "openstack-image::registry"
expect(chef_run).not_to delete_file "/var/lib/glance/glance.sqlite"
end
expect_creates_glance_dir expect_creates_glance_dir
describe "glance-registry.conf" do describe "glance-registry.conf" do