Skip to content

postgres_tablespace.present fails for [x] if x already present #158

Closed
@noelmcloughlin

Description

@noelmcloughlin

Using variation of pillar.example causes formula failure (fedora 26/Salt 2017.7)

   [ERROR   ] Command '['/bin/psql', '--no-align', '--no-readline', '--no-psqlrc', '--no-password', '--dbname', 'postgres', '-c', 'CREATE TABLESPACE "my_space" OWNER "localUser" LOCATION \'/srv/my_tablespace\' ']' failed with return code: 1
    [ERROR   ] stderr: ERROR:  could not set permissions on directory "/srv/my_tablespace": Permission denied
   [ERROR   ] retcode: 1
   [ERROR   ] Error connecting to Postgresql server
   [ERROR   ] An exception occurred in this state: Traceback (most recent call last): File"/usr/lib/python2.7/site-packages/salt/state.py", line 1837, in call  **cdata['kwargs'])  File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper return f(*args, **kwargs) File "/usr/lib/python2.7/site-packages/salt/states/postgres_tablespace.py", line 121, in present if tblspaces[name]['Location'] != directory and not __opts__['test']:
   KeyError: 'my_space'

      ID: postgres_user-localUser
Function: postgres_user.present
    Name: localUser
  Result: True
 Comment: The user localUser has been created
 Started: 00:36:50.125273
Duration: 2517.922 ms
 Changes: 
          ----------
          localUser:
              Present

      ID: postgresql-tablespace-dir-my_space
Function: file.directory
    Name: /srv/my_tablespace
  Result: True
 Comment: Directory /srv/my_tablespace updated
 Started: 00:36:47.685616
Duration: 2.077 ms
 Changes:
          ----------
          /srv/my_tablespace:
              New Dir

      ID: postgres_tablespace-my_space
Function: postgres_tablespace.present
    Name: my_space
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "/usr/lib/python2.7/site-packages/salt/state.py", line 1837, in call
              **cdata['kwargs'])
            File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1794, in wrapper
              return f(*args, **kwargs)
            File "/usr/lib/python2.7/site-packages/salt/states/postgres_tablespace.py", line 121, in present
              if tblspaces[name]['Location'] != directory and not __opts__['test']:
          KeyError: 'my_space'
 Started: 00:36:55.939996
Duration: 697.953 ms
 Changes:

The directory /srv/my_dablespace/ is owned by POSIX user/group "postgres:postgres" with 0700 permissions. There is no POSIX user named localUser

Updating the pillar.example changing user to postgres does not help.

      ID: postgresql-tablespace-dir-my_space
Function: file.directory
    Name: /srv/my_tablespace
  Result: False
 Comment: The following requisites were not found
                           require: postgres_user: postgres_user_postgres
 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