mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-25 03:41:25 -07:00
Bulk autopep8 (modules)
As agreed in 2017-12-07 Core meeting bulk fix pep8 issues Generated using: autopep8 1.3.3 (pycodestyle: 2.3.1) autopep8 -r --max-line-length 160 --in-place --ignore E305,E402,E722,E741 lib/ansible/modules Manually fix issues that autopep8 has introduced
This commit is contained in:
parent
d13d7e9404
commit
c57a7f05e1
314 changed files with 3462 additions and 3383 deletions
|
@ -125,6 +125,7 @@ def set_owner(cursor, schema, owner):
|
|||
cursor.execute(query)
|
||||
return True
|
||||
|
||||
|
||||
def get_schema_info(cursor, schema):
|
||||
query = """
|
||||
SELECT schema_owner AS owner
|
||||
|
@ -134,11 +135,13 @@ def get_schema_info(cursor, schema):
|
|||
cursor.execute(query, {'schema': schema})
|
||||
return cursor.fetchone()
|
||||
|
||||
|
||||
def schema_exists(cursor, schema):
|
||||
query = "SELECT schema_name FROM information_schema.schemata WHERE schema_name = %(schema)s"
|
||||
cursor.execute(query, {'schema': schema})
|
||||
return cursor.rowcount == 1
|
||||
|
||||
|
||||
def schema_delete(cursor, schema):
|
||||
if schema_exists(cursor, schema):
|
||||
query = "DROP SCHEMA %s" % pg_quote_identifier(schema, 'schema')
|
||||
|
@ -147,6 +150,7 @@ def schema_delete(cursor, schema):
|
|||
else:
|
||||
return False
|
||||
|
||||
|
||||
def schema_create(cursor, schema, owner):
|
||||
if not schema_exists(cursor, schema):
|
||||
query_fragments = ['CREATE SCHEMA %s' % pg_quote_identifier(schema, 'schema')]
|
||||
|
@ -162,6 +166,7 @@ def schema_create(cursor, schema, owner):
|
|||
else:
|
||||
return False
|
||||
|
||||
|
||||
def schema_matches(cursor, schema, owner):
|
||||
if not schema_exists(cursor, schema):
|
||||
return False
|
||||
|
@ -176,6 +181,7 @@ def schema_matches(cursor, schema, owner):
|
|||
# Module execution.
|
||||
#
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
|
@ -189,7 +195,7 @@ def main():
|
|||
database=dict(default="postgres"),
|
||||
state=dict(default="present", choices=["absent", "present"]),
|
||||
),
|
||||
supports_check_mode = True
|
||||
supports_check_mode=True
|
||||
)
|
||||
|
||||
if not postgresqldb_found:
|
||||
|
@ -205,13 +211,13 @@ def main():
|
|||
# check which values are empty and don't include in the **kw
|
||||
# dictionary
|
||||
params_map = {
|
||||
"login_host":"host",
|
||||
"login_user":"user",
|
||||
"login_password":"password",
|
||||
"port":"port"
|
||||
"login_host": "host",
|
||||
"login_user": "user",
|
||||
"login_password": "password",
|
||||
"port": "port"
|
||||
}
|
||||
kw = dict( (params_map[k], v) for (k, v) in module.params.items()
|
||||
if k in params_map and v != '' )
|
||||
kw = dict((params_map[k], v) for (k, v) in module.params.items()
|
||||
if k in params_map and v != '')
|
||||
|
||||
# If a login_unix_socket is specified, incorporate it here.
|
||||
is_localhost = "host" not in kw or kw["host"] == "" or kw["host"] == "localhost"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue