From fd35833554c92741d398a1715c528cf13ff60587 Mon Sep 17 00:00:00 2001 From: Andrey Klychkov Date: Wed, 24 Jul 2019 13:10:44 +0300 Subject: [PATCH] postgresql modules: fix by flake8 (#59497) --- .../modules/database/postgresql/postgresql_db.py | 6 ++---- .../modules/database/postgresql/postgresql_ext.py | 1 - .../modules/database/postgresql/postgresql_lang.py | 2 -- .../modules/database/postgresql/postgresql_table.py | 10 +++------- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/lib/ansible/modules/database/postgresql/postgresql_db.py b/lib/ansible/modules/database/postgresql/postgresql_db.py index b67b46e280d..3f97dfa28d1 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_db.py +++ b/lib/ansible/modules/database/postgresql/postgresql_db.py @@ -265,8 +265,7 @@ def db_create(cursor, db, owner, template, encoding, lc_collate, lc_ctype, conn_ return True else: db_info = get_db_info(cursor, db) - if (encoding and - get_encoding_id(cursor, encoding) != db_info['encoding_id']): + if (encoding and get_encoding_id(cursor, encoding) != db_info['encoding_id']): raise NotSupportedError( 'Changing database encoding is not supported. ' 'Current encoding: %s' % db_info['encoding'] @@ -301,8 +300,7 @@ def db_matches(cursor, db, owner, template, encoding, lc_collate, lc_ctype, conn return False else: db_info = get_db_info(cursor, db) - if (encoding and - get_encoding_id(cursor, encoding) != db_info['encoding_id']): + if (encoding and get_encoding_id(cursor, encoding) != db_info['encoding_id']): return False elif lc_collate and lc_collate != db_info['lc_collate']: return False diff --git a/lib/ansible/modules/database/postgresql/postgresql_ext.py b/lib/ansible/modules/database/postgresql/postgresql_ext.py index a589cfe0aaa..1d7e886a8c2 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_ext.py +++ b/lib/ansible/modules/database/postgresql/postgresql_ext.py @@ -174,7 +174,6 @@ from ansible.module_utils.postgres import ( postgres_common_argument_spec, ) from ansible.module_utils._text import to_native -from ansible.module_utils.database import pg_quote_identifier executed_queries = [] diff --git a/lib/ansible/modules/database/postgresql/postgresql_lang.py b/lib/ansible/modules/database/postgresql/postgresql_lang.py index 7b978283655..7e18a615d8c 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_lang.py +++ b/lib/ansible/modules/database/postgresql/postgresql_lang.py @@ -164,8 +164,6 @@ from ansible.module_utils.postgres import ( get_conn_params, postgres_common_argument_spec, ) -from ansible.module_utils._text import to_native -from ansible.module_utils.database import pg_quote_identifier executed_queries = [] diff --git a/lib/ansible/modules/database/postgresql/postgresql_table.py b/lib/ansible/modules/database/postgresql/postgresql_table.py index 63d66914098..93365aa9b2c 100644 --- a/lib/ansible/modules/database/postgresql/postgresql_table.py +++ b/lib/ansible/modules/database/postgresql/postgresql_table.py @@ -480,21 +480,17 @@ def main(): module.warn("cascade=true is ignored when state=present") # Check mutual exclusive parameters: - if state == 'absent' and (truncate or newname or columns or tablespace or - like or storage_params or unlogged or - owner or including): + if state == 'absent' and (truncate or newname or columns or tablespace or like or storage_params or unlogged or owner or including): module.fail_json(msg="%s: state=absent is mutually exclusive with: " "truncate, rename, columns, tablespace, " "including, like, storage_params, unlogged, owner" % table) - if truncate and (newname or columns or like or unlogged or - storage_params or owner or tablespace or including): + if truncate and (newname or columns or like or unlogged or storage_params or owner or tablespace or including): module.fail_json(msg="%s: truncate is mutually exclusive with: " "rename, columns, like, unlogged, including, " "storage_params, owner, tablespace" % table) - if newname and (columns or like or unlogged or - storage_params or owner or tablespace or including): + if newname and (columns or like or unlogged or storage_params or owner or tablespace or including): module.fail_json(msg="%s: rename is mutually exclusive with: " "columns, like, unlogged, including, " "storage_params, owner, tablespace" % table)