Skip to content

fix: Syntax error: Unterminated quoted string #338

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

Closed
wants to merge 1 commit into from
Closed

fix: Syntax error: Unterminated quoted string #338

wants to merge 1 commit into from

Conversation

thde
Copy link

@thde thde commented Oct 7, 2021

I've got the same error as @waipeng reported here in #330 (comment). This MR fixes the unterminated quotes string issue in the unless clause.

I use the manage_database param without letting the module manage postgres itself.

Debug: Executing with uid=postgres gid=postgres: 'psql -d puppetdb -t -X -c "SELECT COUNT(*) FROM (SELECT
                  ns.nspname,
                  acl.defaclobjtype,
                  acl.defaclacl
                FROM pg_default_acl acl
                JOIN pg_namespace ns ON acl.defaclnamespace=ns.oid
                WHERE acl.defaclacl::text ~ '.*\\\"puppetdb-read\\\"=r/puppetdb\\".*'
                AND nspname = 'public') count"'
Error: /Stage[main]/Puppetdb::Database::Postgresql/Puppetdb::Database::Read_only_user[puppetdb-read]/Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read]/Postgresql_psql[grant defa
ult select permission for puppetdb-read]: Could not evaluate: Error evaluating 'unless' clause, returned pid 31435 exit 2: 'sh: 8: Syntax error: Unterminated quoted string
'
Debug: Executing with uid=postgres gid=postgres: 'psql -d puppetdb -t -X -c "SELECT COUNT(*) FROM (SELECT
                  ns.nspname,
                  acl.defaclobjtype,
                  acl.defaclacl
                FROM pg_default_acl acl
                JOIN pg_namespace ns ON acl.defaclnamespace=ns.oid
                WHERE acl.defaclacl::text ~ '.*\\\"puppetdb-read\\\"=U/puppetdb\\".*'
                AND nspname = 'public') count"'
Error: /Stage[main]/Puppetdb::Database::Postgresql/Puppetdb::Database::Read_only_user[puppetdb-read]/Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read]/Postgresql_psql[grant defa
ult usage permission for puppetdb-read]: Could not evaluate: Error evaluating 'unless' clause, returned pid 31438 exit 2: 'sh: 8: Syntax error: Unterminated quoted string
'
Debug: Executing with uid=postgres gid=postgres: 'psql -d puppetdb -t -X -c "SELECT COUNT(*) FROM (SELECT
                  ns.nspname,
                  acl.defaclobjtype,
                  acl.defaclacl
                FROM pg_default_acl acl
                JOIN pg_namespace ns ON acl.defaclnamespace=ns.oid
                WHERE acl.defaclacl::text ~ '.*\\\"puppetdb-read\\\"=X/puppetdb\\".*'
                AND nspname = 'public') count"'
Error: /Stage[main]/Puppetdb::Database::Postgresql/Puppetdb::Database::Read_only_user[puppetdb-read]/Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read]/Postgresql_psql[grant defa
ult execute permission for puppetdb-read]: Could not evaluate: Error evaluating 'unless' clause, returned pid 31441 exit 2: 'sh: 8: Syntax error: Unterminated quoted string
'

@thde thde requested a review from a team as a code owner October 7, 2021 11:29
@CLAassistant
Copy link

CLAassistant commented Oct 7, 2021

CLA assistant check
All committers have signed the CLA.

@puppet-community-rangefinder
Copy link

puppetdb::database::default_read_grant is a type

that may have no external impact to Forge modules.

This module is declared in 33 of 578 indexed public Puppetfiles.


These results were generated with Rangefinder, a tool that helps predict the downstream impact of breaking changes to elements used in Puppet modules. You can run this on the command line to get a full report.

Exact matches are those that we can positively identify via namespace and the declaring modules' metadata. Non-namespaced items, such as Puppet 3.x functions, will always be reported as near matches only.

@thde
Copy link
Author

thde commented Oct 7, 2021

Ok, this change seems to fix the error. But the unless command returns 0 every time:

Debug: /Stage[main]/Puppetdb::Database::Postgresql/Puppetdb::Database::Read_only_user[puppetdb-read]/Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read]/Postgresql_psql[grant defa
ult select permission for puppetdb-read]: The container Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read] will propagate my refresh event
Debug: Executing with uid=postgres gid=postgres: 'psql -d puppetdb -t -X -c "SELECT COUNT(*) FROM (SELECT
                  ns.nspname,
                  acl.defaclobjtype,
                  acl.defaclacl
                FROM pg_default_acl acl
                JOIN pg_namespace ns ON acl.defaclnamespace=ns.oid
                WHERE acl.defaclacl::text ~ '.*\\\"puppetdb-read\\\"=U/puppetdb\\\".*'
                AND nspname = 'public') count"'
Debug: /Stage[main]/Puppetdb::Database::Postgresql/Puppetdb::Database::Read_only_user[puppetdb-read]/Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read]/Postgresql_psql[grant defa
ult usage permission for puppetdb-read]/unless: Found 0 row(s) executing 'unless' clause
Debug: Executing with uid=postgres gid=postgres: 'psql -d puppetdb -t -X -c "ALTER DEFAULT PRIVILEGES
                  FOR USER \"puppetdb\"
                  IN SCHEMA \"public\"
                GRANT USAGE ON SEQUENCES
                  TO \"puppetdb-read\""'
Notice: /Stage[main]/Puppetdb::Database::Postgresql/Puppetdb::Database::Read_only_user[puppetdb-read]/Puppetdb::Database::Default_read_grant[puppetdb grant read permission on new objects from puppetdb to puppetdb-read]/Postgresql_psql[grant def
ault usage permission for puppetdb-read]/command: command changed 'notrun' to "ALTER DEFAULT PRIVILEGES\n                  FOR USER \"puppetdb\"\n                  IN SCHEMA \"public\"\n                GRANT USAGE ON SEQUENCES\n
  TO \"puppetdb-read\"" (corrective)

@igomura
Copy link

igomura commented Dec 1, 2021

Oh, it looks like we are fixing the same spot. Please check my PR here #339
I have my local copy of the module with this fix and it works as expected.

@thde
Copy link
Author

thde commented Dec 1, 2021

Thanks @igomura. Closing this in favour of #339

@thde thde closed this Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants