saltstack-formulas/postgres-formula

postgresql-cluster-prepared state is broken

EvaSDK opened this issue · 6 comments

Current logic for postgresql-cluster-prepared state does not work on Debian OS family and other OSes most likely due to initdb and create_cluster being false by default. The flaws is that the id cover two boolean that create 4 different states at least 2 of which are invalid (both true and both false).

I will submit a PR to clean that up in a few minutes.

@EvaSDK I'm sorry to say but there isn't a pg_createcluster on Archlinux so your modification will fail on Archlinux, and I couldn't find anything usefull in the postgres source code,
so this looks like a ubuntu / debian specific command...

Can you confirm this?

local:
----------
          ID: postgresql-cluster-prepared
    Function: cmd.run
        Name: test -f /var/lib/postgres/data/environment
      Result: False
     Comment: Command "test -f /var/lib/postgres/data/environment" run
     Started: 21:44:11.121038
    Duration: 63.02 ms
     Changes:   
              ----------
              pid:
                  3277
              retcode:
                  1
              stderr:
              stdout:

Summary for local

I didn't add that command.

As for the existence of this file, this is located in /etc/postgresql/{{ version }}/{{ cluster_name}}/environment in Debian but it does seem this is specific to Debian tools. I will have a look at this now.

Ok so I got tricked by the formula into thinking initdb is actually createdb so my fix is indeed wrong but so was the formula anyway. https://www.postgresql.org/docs/9.4/static/creating-cluster.html

@EvaSDK Thanks for looking into this, can you create a pr? or should I

I am working on it right now.

Fixed.