__postgres_role has syntax error on gencode-remote #107

Closed
opened 2021-11-20 13:24:01 +00:00 by ungleich-gitea · 3 comments

Created by: greendeath

I currently get this error:

Error processing object '__postgres_role/request'
=================================================
name: __postgres_role/request
path: /tmp/tmpdumwt1ua/6d0c9ed5219e18d6b2643b71690f2c22/data/object/__postgres_role/request/.cdist-8__wwa35
type: /home/rouxdo/Nextcloud/Work/bin/cdist/cdist/conf/type/__postgres_role

code-remote:stderr
------------------
ERROR:  syntax error at or near "XXXX"
LINE 1: CREATE ROLE user WITH PASSWORD XXX...
                                          ^

the gencode-remote looks like the following:

...
        [ -n "$password" ] && password="PASSWORD '$password'"

        cmd="CREATE ROLE $name WITH $password $booleans"
        echo "su - '$postgres_user' -c \"psql postgres -c '$cmd'\""
...

Also if I directly type in the command on the command line, I get the same error
Only if I try to first login into the postgres user and then run the command
with psql postgres -c "CREATE... PASSWORD 'XXXX'"
then it works, so it looks like a problem with " and '

Running the cdist type against a Debian 9.6

*Created by: greendeath* I currently get this error: ``` Error processing object '__postgres_role/request' ================================================= name: __postgres_role/request path: /tmp/tmpdumwt1ua/6d0c9ed5219e18d6b2643b71690f2c22/data/object/__postgres_role/request/.cdist-8__wwa35 type: /home/rouxdo/Nextcloud/Work/bin/cdist/cdist/conf/type/__postgres_role code-remote:stderr ------------------ ERROR: syntax error at or near "XXXX" LINE 1: CREATE ROLE user WITH PASSWORD XXX... ^ ``` the gencode-remote looks like the following: ``` ... [ -n "$password" ] && password="PASSWORD '$password'" cmd="CREATE ROLE $name WITH $password $booleans" echo "su - '$postgres_user' -c \"psql postgres -c '$cmd'\"" ... ``` Also if I directly type in the command on the command line, I get the same error Only if I try to first login into the postgres user and then run the command with `psql postgres -c "CREATE... PASSWORD 'XXXX'" ` then it works, so it looks like a problem with `"` and `'` Running the cdist type against a Debian 9.6
Author
Owner

Created by: darko-poljak

Fixed in 45d1037491.

*Created by: darko-poljak* Fixed in 45d10374912ee215650efa622cc3af577a0c19ea.
Author
Owner

Created by: darko-poljak

@greendeath ?

*Created by: darko-poljak* @greendeath ?
Author
Owner

Created by: darko-poljak

@greendeath Can you test this changes https://github.com/darko-poljak/cdist/tree/bugfix/github-722/__postgres_role-syntax-error ?

*Created by: darko-poljak* @greendeath Can you test this changes https://github.com/darko-poljak/cdist/tree/bugfix/github-722/__postgres_role-syntax-error ?
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: ungleich-public/cdist#107
No description provided.