Merge pull request #592 from exi/extension-quote-fix

(MODULES-1878) properly quote create and drop extension statements
This commit is contained in:
Hunter Haugen 2015-03-23 10:34:23 -07:00
commit 4a96679a65
2 changed files with 6 additions and 6 deletions

View file

@ -9,7 +9,7 @@ define postgresql::server::extension (
$group = $postgresql::server::group
$psql_path = $postgresql::server::psql_path
$port = $postgresql::server::port
# Set the defaults for the postgresql_psql resource
Postgresql_psql {
psql_user => $user,
@ -20,14 +20,14 @@ define postgresql::server::extension (
case $ensure {
'present': {
$command = "CREATE EXTENSION ${name}"
$command = "CREATE EXTENSION \"${name}\""
$unless_comp = '='
$package_require = undef
$package_before = Postgresql_psql["Add ${title} extension to ${database}"]
}
'absent': {
$command = "DROP EXTENSION ${name}"
$command = "DROP EXTENSION \"${name}\""
$unless_comp = '!='
$package_require = Postgresql_psql["Add ${title} extension to ${database}"]
$package_before = undef

View file

@ -29,7 +29,7 @@ describe 'postgresql::server::extension', :type => :define do
it {
is_expected.to contain_postgresql_psql('Add postgis extension to template_postgis').with({
:db => 'template_postgis',
:command => 'CREATE EXTENSION postgis',
:command => 'CREATE EXTENSION "postgis"',
:unless => "SELECT t.count FROM (SELECT count(extname) FROM pg_extension WHERE extname = 'postgis') as t WHERE t.count = 1",
}).that_requires('Postgresql::Server::Database[template_postgis]')
}
@ -57,7 +57,7 @@ describe 'postgresql::server::extension', :type => :define do
it {
is_expected.to contain_postgresql_psql('Add postgis extension to template_postgis').with({
:db => 'template_postgis',
:command => 'DROP EXTENSION postgis',
:command => 'DROP EXTENSION "postgis"',
:unless => "SELECT t.count FROM (SELECT count(extname) FROM pg_extension WHERE extname = 'postgis') as t WHERE t.count != 1",
}).that_requires('Postgresql::Server::Database[template_postgis]')
}
@ -77,7 +77,7 @@ describe 'postgresql::server::extension', :type => :define do
it {
is_expected.to contain_postgresql_psql('Add postgis extension to template_postgis').with({
:db => 'template_postgis',
:command => 'DROP EXTENSION postgis',
:command => 'DROP EXTENSION "postgis"',
:unless => "SELECT t.count FROM (SELECT count(extname) FROM pg_extension WHERE extname = 'postgis') as t WHERE t.count != 1",
}).that_requires('Postgresql::Server::Database[template_postgis]')
}