postgresql modules: fix by flake8 (#59497)

This commit is contained in:
Andrey Klychkov 2019-07-24 13:10:44 +03:00 committed by Abhijeet Kasurde
parent 93265bf92e
commit fd35833554
4 changed files with 5 additions and 14 deletions

View file

@ -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

View file

@ -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 = []

View file

@ -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 = []

View file

@ -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)