Skip to content
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

postgresql modules: fix by flake8 #59497

Merged
merged 1 commit into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions lib/ansible/modules/database/postgresql/postgresql_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lib/ansible/modules/database/postgresql/postgresql_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@
postgres_common_argument_spec,
)
from ansible.module_utils._text import to_native
from ansible.module_utils.database import pg_quote_identifier

executed_queries = []

Expand Down
2 changes: 0 additions & 2 deletions lib/ansible/modules/database/postgresql/postgresql_lang.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@
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 = []

Expand Down
10 changes: 3 additions & 7 deletions lib/ansible/modules/database/postgresql/postgresql_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down