Skip to content

Darwin: postgres_schema.present throwing exception #163

@noelmcloughlin

Description

@noelmcloughlin

On Darwin the POSIX user/group created by default is named "_postgres". An exception is thrown because salt tries to "runas: postgres" but this user does not exist.

OS: Darwin 15.6.0, Salt Version: saltstack: stable 2017.7.1 (bottled), HEAD

      ID: postgres_schema-uuid_ossp
Function: postgres_schema.present
    Name: uuid_ossp
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/state.py", line 1837, in call
              **cdata['kwargs'])
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper
              return f(*args, **kwargs)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/states/postgres_schema.py", line 74, in present
              schema_attr = __salt__['postgres.schema_get'](dbname, name, **db_args)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/postgres.py", line 2108, in schema_get
              db_password=db_password)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/postgres.py", line 2160, in schema_list
              password=db_password)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/postgres.py", line 428, in psql_query
              password=password)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/postgres.py", line 367, in _psql_prepare_and_run
              rcmd, runas=runas, password=password, host=host, port=port, user=user)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/postgres.py", line 184, in _run_psql
              ret = __salt__['cmd.run_all'](cmd, python_shell=False, **kwargs)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 1699, in run_all
              **kwargs)
            File "/usr/local/Cellar/saltstack/2017.7.1/libexec/lib/python2.7/site-packages/salt/modules/cmdmod.py", line 409, in _run
              'User \'{0}\' is not available'.format(runas)
          CommandExecutionError: User 'postgres' is not available
 Started: 01:40:38.529985
Duration: 3.858 ms
 Changes: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions