Commit 2e8fab6bf90c8bd1f39f7e45f1ee9a3c51b0b392
1 parent
e2c3d426
Exists in
master
and in
17 other branches
Capture the full DB / user name
Showing
1 changed file
with
4 additions
and
4 deletions
Show diff stats
files/gitlab-cookbooks/gitlab/libraries/helper.rb
@@ -30,8 +30,8 @@ class PgHelper | @@ -30,8 +30,8 @@ class PgHelper | ||
30 | 30 | ||
31 | def database_exists?(db_name) | 31 | def database_exists?(db_name) |
32 | psql_cmd(["-d 'template1'", | 32 | psql_cmd(["-d 'template1'", |
33 | - "-c 'select datname from pg_database' -x", | ||
34 | - "| grep #{db_name}"]) | 33 | + "-c 'select datname from pg_database' -A", |
34 | + "| grep -x #{db_name}"]) | ||
35 | end | 35 | end |
36 | 36 | ||
37 | def sql_user_exists? | 37 | def sql_user_exists? |
@@ -44,8 +44,8 @@ class PgHelper | @@ -44,8 +44,8 @@ class PgHelper | ||
44 | 44 | ||
45 | def user_exists?(db_user) | 45 | def user_exists?(db_user) |
46 | psql_cmd(["-d 'template1'", | 46 | psql_cmd(["-d 'template1'", |
47 | - "-c 'select usename from pg_user' -x", | ||
48 | - "|grep #{db_user}"]) | 47 | + "-c 'select usename from pg_user' -A", |
48 | + "|grep -x #{db_user}"]) | ||
49 | end | 49 | end |
50 | 50 | ||
51 | def psql_cmd(cmd_list) | 51 | def psql_cmd(cmd_list) |