mirror of
				https://github.com/spantaleev/matrix-docker-ansible-deploy.git
				synced 2025-11-04 09:08:56 +01:00 
			
		
		
		
	Make Postgres import not break for databases with special names
We haven't encountered such a problem yet, but it doesn't hurt to make things more robust.
This commit is contained in:
		@@ -84,7 +84,9 @@ matrix_postgres_import_roles_to_ignore: |
 | 
			
		||||
# which is unsupported by default by newer Postgres versions (v14+).
 | 
			
		||||
# When users are created and passwords are set by the playbook, they end up hashed as `scram-sha-256` on Postgres v14+.
 | 
			
		||||
# If an md5-hashed password is restored on top, Postgres v14+ will refuse to authenticate users with it by default.
 | 
			
		||||
matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE ({{ matrix_postgres_import_roles_to_ignore | join('|') }})(;| WITH)"  # noqa jinja[spacing]
 | 
			
		||||
#
 | 
			
		||||
# We also allow for the role name to be quoted, which is rare, but might happen for role names which are special keywords (e.g. `default`).
 | 
			
		||||
matrix_postgres_import_roles_ignore_regex: "^(CREATE|ALTER) ROLE \\\"?({{ matrix_postgres_import_roles_to_ignore | join('|') }})\\\"?(;| WITH)"  # noqa jinja[spacing]
 | 
			
		||||
 | 
			
		||||
# A list of databases to avoid creating when importing (or upgrading) the database.
 | 
			
		||||
# If a dump file contains the databases and they've also been created beforehand (see `matrix_postgres_additional_databases`),
 | 
			
		||||
@@ -97,7 +99,8 @@ matrix_postgres_import_databases_to_ignore: |
 | 
			
		||||
    matrix_postgres_additional_databases|map(attribute='name') | list
 | 
			
		||||
  }}
 | 
			
		||||
 | 
			
		||||
matrix_postgres_import_databases_ignore_regex: "^CREATE DATABASE ({{ matrix_postgres_import_databases_to_ignore | join('|') }})\\s"  # noqa jinja[spacing]
 | 
			
		||||
# We also allow for the database name to be quoted, which is rare, but might happen for database names which are special keywords (e.g. `default`).
 | 
			
		||||
matrix_postgres_import_databases_ignore_regex: "^CREATE DATABASE \\\"?({{ matrix_postgres_import_databases_to_ignore | join('|') }})\\\"?\\s"  # noqa jinja[spacing]
 | 
			
		||||
 | 
			
		||||
# The number of seconds to wait after starting `matrix-postgres.service`
 | 
			
		||||
# and before trying to run queries for creating additional databases/users against it.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user