From 2af3fafcc30975909b1f5352e37ef1c6e79274f5 Mon Sep 17 00:00:00 2001 From: galstrom21 Date: Mon, 18 Nov 2013 11:50:42 -0600 Subject: [PATCH] Fixing db_uri for sqlite connection string * Corrected for relative path * Corrected for absolute path Fixes: bug 1252390 Change-Id: Ibef45a20cf53b87ea3a71674e4f0ab13d4c2e655 --- CHANGELOG.md | 6 ++++++ libraries/endpoints.rb | 5 ++++- metadata.rb | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f00813dc..7bb7ba15 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ This file is used to list changes made in each version of cookbook-openstack-common. +## 0.4.6: +### Bug +* Ensuring `#db_uri` returns a valid sqlite connection string + * relative path example: 'path' = 'path/to/foo.db' -- will return sqlite:///foo.db + * absolute path example: 'path' = '/path/to/foo.db' -- will return sqlite:////foo.db + ## 0.4.5: * Added `openstack-common::set_endpoints_by_interface` to enable using `bind_interface` with endpoints rather than hard-code the IP addresses in an diff --git a/libraries/endpoints.rb b/libraries/endpoints.rb index 92812fa1..6b1de45d 100644 --- a/libraries/endpoints.rb +++ b/libraries/endpoints.rb @@ -69,8 +69,11 @@ module ::Openstack result = "#{type}://#{user}:#{pass}@#{host}:#{port}/#{name}" when "sqlite" # SQLite uses filepaths not db name + # README(galstrom): 3 slashes is a relative path, 4 slashes is an absolute path + # example: info['path'] = 'path/to/foo.db' -- will return sqlite:///foo.db + # example: info['path'] = '/path/to/foo.db' -- will return sqlite:////foo.db path = info['path'] - result = "sqlite://#{path}" + result = "sqlite:///#{path}" end end end diff --git a/metadata.rb b/metadata.rb index f29fc398..2ecf91b9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ maintainer_email "cookbooks@lists.tfoundry.com" license "Apache 2.0" description "Common OpenStack attributes, libraries and recipes." long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.4.5" +version "0.4.6" recipe "openstack-common", "Installs/Configures common recipes" recipe "openstack-common::set_endpoints_by_interface", "Set endpoints by interface"