Skip to content

Commit 5419aa6

Browse files
authored
Merge pull request #1021 from flaviogurgel/fixpsqlrc
Ignore .psqlrc so output is clean and doesn't break Puppet
2 parents 346e672 + 58e8f05 commit 5419aa6

File tree

2 files changed

+7
-7
lines changed
  • lib/puppet/provider/postgresql_psql
  • spec/unit/puppet/provider/postgresql_psql

2 files changed

+7
-7
lines changed

lib/puppet/provider/postgresql_psql/ruby.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def run_sql_command(sql)
1313
command = [resource[:psql_path]]
1414
command.push('-d', resource[:db]) if resource[:db]
1515
command.push('-p', resource[:port]) if resource[:port]
16-
command.push('-t', '-c', '"' + sql.gsub('"', '\"') + '"')
16+
command.push('-t', '-X', '-c', '"' + sql.gsub('"', '\"') + '"')
1717

1818
environment = get_environment
1919

spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
it 'executes with the given psql_path on the given DB' do
1515
expect(provider).to receive(:run_command).with(['psql', '-d',
16-
attributes[:db], '-t', '-c', '"SELECT \'something\' as \"Custom column\""'], 'postgres',
16+
attributes[:db], '-t', '-X', '-c', '"SELECT \'something\' as \"Custom column\""'], 'postgres',
1717
'postgres', {})
1818

1919
provider.run_sql_command('SELECT \'something\' as "Custom column"')
@@ -33,7 +33,7 @@
3333
it 'executes with the given psql_path on the given DB' do
3434
expect(Dir).to receive(:chdir).with(attributes[:cwd]).and_yield
3535
expect(provider).to receive(:run_command).with([attributes[:psql_path],
36-
'-d', attributes[:db], '-t', '-c', '"SELECT \'something\' as \"Custom column\""'],
36+
'-d', attributes[:db], '-t', '-X', '-c', '"SELECT \'something\' as \"Custom column\""'],
3737
attributes[:psql_user], attributes[:psql_group], {})
3838

3939
provider.run_sql_command('SELECT \'something\' as "Custom column"')
@@ -47,7 +47,7 @@
4747
end
4848

4949
it 'executes with the given search_path' do
50-
expect(provider).to receive(:run_command).with(['psql', '-t', '-c',
50+
expect(provider).to receive(:run_command).with(['psql', '-t', '-X', '-c',
5151
'"set search_path to schema1; SELECT \'something\' as \"Custom column\""'],
5252
'postgres', 'postgres', {})
5353

@@ -62,7 +62,7 @@
6262
end
6363

6464
it 'executes with the given search_path' do
65-
expect(provider).to receive(:run_command).with(['psql', '-t', '-c',
65+
expect(provider).to receive(:run_command).with(['psql', '-t', '-X', '-c',
6666
'"set search_path to schema1,schema2; SELECT \'something\' as \"Custom column\""'],
6767
'postgres', 'postgres',
6868
{})
@@ -77,7 +77,7 @@
7777
it 'executes with the given port' do
7878
expect(provider).to receive(:run_command).with(['psql',
7979
'-p', '5555',
80-
'-t', '-c', '"SELECT something"'],
80+
'-t', '-X', '-c', '"SELECT something"'],
8181
'postgres', 'postgres', {})
8282

8383
provider.run_sql_command('SELECT something')
@@ -88,7 +88,7 @@
8888

8989
it 'executes with the given host' do
9090
expect(provider).to receive(:run_command).with(['psql',
91-
'-t', '-c',
91+
'-t', '-X', '-c',
9292
'"SELECT something"'],
9393
'postgres', 'postgres', 'PGHOST' => '127.0.0.1')
9494

0 commit comments

Comments
 (0)