Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres.* calls fail with postgresql 9.6 and .psqlrc custom file #36787

Closed
maximeguillet opened this issue Oct 5, 2016 · 1 comment
Closed
Labels
Bug broken, incorrect, or confusing behavior Execution-Module P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@maximeguillet
Copy link
Contributor

Description of Issue/Question

All salt commands and states calling postgres.* fail when options are set in a .psqlrc file in postgres system user with postgresql 9.6.

Setup

  • Install postgresql 9.6
  • Setup a .psqlrc with options like \timing on or \x auto
# cat << EOF > ~postgres/.psqlrc
\timing on
\x auto
EOF

Steps to Reproduce Issue

  • Run a postgres.* salt command :
# salt-call postgres.version

local:
    Timing is on.

# salt-call postgres.db_list
[ERROR   ] An un-handled exception was caught by salt's global exception handler:
KeyError: 'Name'
Traceback (most recent call last):
  File "/usr/bin/salt-call", line 11, in <module>
    salt_call()
  File "/usr/lib/python2.7/dist-packages/salt/scripts.py", line 352, in salt_call
    client.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/call.py", line 58, in run
    caller.run()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 134, in run
    ret = self.call()
  File "/usr/lib/python2.7/dist-packages/salt/cli/caller.py", line 197, in call
    ret['return'] = func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/modules/postgres.py", line 435, in db_list
    ret[row['Name']] = row

Versions Report

Salt Version:
           Salt: 2016.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.6
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.6
$ psql --version
psql (PostgreSQL) 9.6.0
@gtmanfred
Copy link
Contributor

Thanks for the pr!

@gtmanfred gtmanfred added Execution-Module Bug broken, incorrect, or confusing behavior severity-low 4th level, cosemtic problems, work around exists P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps TEAM Platform labels Oct 5, 2016
@gtmanfred gtmanfred added this to the Approved milestone Oct 5, 2016
gitebra pushed a commit to gitebra/salt that referenced this issue Oct 10, 2016
* upstream/develop: (29 commits)
  Fix shell_info docstring example (saltstack#36874)
  missing docs for salt.modules.apcups (saltstack#36863)
  Add '--no-psqlrc' option to new-to-carbon postgres unit test
  Doc updates for Carbon release candidate (saltstack#36847)
  Fix issue 36679 win_servermanager failure
  Pylint fix
  states: glance: handle image list instead of dict
  states: glance: import keystone exceptions from new location
  do not load libvirt pillar if certtool is unavailable
  Fix one remaining postgresql tests linked to saltstack#36787.
  Error on reaction with missing SLS file
  Fix postgresql tests using position in the argument list of psql.
  Fix postgresql tests by adding --no-psqlrc option introduced by saltstack#36787.
  Fix behavior of psql -c option with postgresql 9.6
  Update alternatives module to strip newline chars
  add __utils__ to vultr cloud provider
  Another bit of detection for failed pip tests
  Base rpmdev-vercmp comparison result on retcode
  modules.archive int tests: check for gzip, rar
  Fix issue where test suite could hang on shutdown
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module P4 Priority 4 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests

2 participants