Skip to content

Commit 4a96679

Browse files
committed
Merge pull request puppetlabs#592 from exi/extension-quote-fix
(MODULES-1878) properly quote create and drop extension statements
2 parents a189ed7 + 1ecc5bc commit 4a96679

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

manifests/server/extension.pp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$group = $postgresql::server::group
1010
$psql_path = $postgresql::server::psql_path
1111
$port = $postgresql::server::port
12-
12+
1313
# Set the defaults for the postgresql_psql resource
1414
Postgresql_psql {
1515
psql_user => $user,
@@ -20,14 +20,14 @@
2020

2121
case $ensure {
2222
'present': {
23-
$command = "CREATE EXTENSION ${name}"
23+
$command = "CREATE EXTENSION \"${name}\""
2424
$unless_comp = '='
2525
$package_require = undef
2626
$package_before = Postgresql_psql["Add ${title} extension to ${database}"]
2727
}
2828

2929
'absent': {
30-
$command = "DROP EXTENSION ${name}"
30+
$command = "DROP EXTENSION \"${name}\""
3131
$unless_comp = '!='
3232
$package_require = Postgresql_psql["Add ${title} extension to ${database}"]
3333
$package_before = undef

spec/unit/defines/server/extension_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
it {
3030
is_expected.to contain_postgresql_psql('Add postgis extension to template_postgis').with({
3131
:db => 'template_postgis',
32-
:command => 'CREATE EXTENSION postgis',
32+
:command => 'CREATE EXTENSION "postgis"',
3333
:unless => "SELECT t.count FROM (SELECT count(extname) FROM pg_extension WHERE extname = 'postgis') as t WHERE t.count = 1",
3434
}).that_requires('Postgresql::Server::Database[template_postgis]')
3535
}
@@ -57,7 +57,7 @@
5757
it {
5858
is_expected.to contain_postgresql_psql('Add postgis extension to template_postgis').with({
5959
:db => 'template_postgis',
60-
:command => 'DROP EXTENSION postgis',
60+
:command => 'DROP EXTENSION "postgis"',
6161
:unless => "SELECT t.count FROM (SELECT count(extname) FROM pg_extension WHERE extname = 'postgis') as t WHERE t.count != 1",
6262
}).that_requires('Postgresql::Server::Database[template_postgis]')
6363
}
@@ -77,7 +77,7 @@
7777
it {
7878
is_expected.to contain_postgresql_psql('Add postgis extension to template_postgis').with({
7979
:db => 'template_postgis',
80-
:command => 'DROP EXTENSION postgis',
80+
:command => 'DROP EXTENSION "postgis"',
8181
:unless => "SELECT t.count FROM (SELECT count(extname) FROM pg_extension WHERE extname = 'postgis') as t WHERE t.count != 1",
8282
}).that_requires('Postgresql::Server::Database[template_postgis]')
8383
}

0 commit comments

Comments
 (0)