mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 20:31:27 -07:00
pep8 fixes
This commit is contained in:
parent
27e518a0b1
commit
c0747b7baa
12 changed files with 60 additions and 56 deletions
|
@ -369,7 +369,7 @@ class Runner(object):
|
||||||
conn = None
|
conn = None
|
||||||
actual_host = inject.get('ansible_ssh_host', host)
|
actual_host = inject.get('ansible_ssh_host', host)
|
||||||
actual_port = port
|
actual_port = port
|
||||||
if self.transport in ['paramiko', 'ssh' ]:
|
if self.transport in [ 'paramiko', 'ssh' ]:
|
||||||
actual_port = inject.get('ansible_ssh_port', port)
|
actual_port = inject.get('ansible_ssh_port', port)
|
||||||
|
|
||||||
# the delegated host may have different SSH port configured, etc
|
# the delegated host may have different SSH port configured, etc
|
||||||
|
|
|
@ -142,10 +142,13 @@ def is_failed(result):
|
||||||
return ((result.get('rc', 0) != 0) or (result.get('failed', False) in [ True, 'True', 'true']))
|
return ((result.get('rc', 0) != 0) or (result.get('failed', False) in [ True, 'True', 'true']))
|
||||||
|
|
||||||
def check_conditional(conditional):
|
def check_conditional(conditional):
|
||||||
|
|
||||||
def is_set(var):
|
def is_set(var):
|
||||||
return not var.startswith("$")
|
return not var.startswith("$")
|
||||||
|
|
||||||
def is_unset(var):
|
def is_unset(var):
|
||||||
return var.startswith("$")
|
return var.startswith("$")
|
||||||
|
|
||||||
return eval(conditional.replace("\n", "\\n"))
|
return eval(conditional.replace("\n", "\\n"))
|
||||||
|
|
||||||
def is_executable(path):
|
def is_executable(path):
|
||||||
|
|
|
@ -154,7 +154,7 @@ def add_job(name,job,tmpfile):
|
||||||
def update_job(name,job,tmpfile):
|
def update_job(name,job,tmpfile):
|
||||||
return _update_job(name,job,tmpfile,do_add_job)
|
return _update_job(name,job,tmpfile,do_add_job)
|
||||||
|
|
||||||
def do_add_job (lines, comment, job):
|
def do_add_job(lines, comment, job):
|
||||||
lines.append(comment)
|
lines.append(comment)
|
||||||
lines.append(job)
|
lines.append(job)
|
||||||
|
|
||||||
|
|
|
@ -157,12 +157,14 @@ def absent(module, dest, regexp, backup):
|
||||||
f.close()
|
f.close()
|
||||||
cre = re.compile(regexp)
|
cre = re.compile(regexp)
|
||||||
found = []
|
found = []
|
||||||
|
|
||||||
def matcher(line):
|
def matcher(line):
|
||||||
if cre.search(line):
|
if cre.search(line):
|
||||||
found.append(line)
|
found.append(line)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
lines = filter(matcher, lines)
|
lines = filter(matcher, lines)
|
||||||
changed = len(found) > 0
|
changed = len(found) > 0
|
||||||
if changed:
|
if changed:
|
||||||
|
|
|
@ -214,7 +214,6 @@ def privileges_grant(cursor, user,host,db_table,priv):
|
||||||
query = "GRANT %s ON %s TO '%s'@'%s'" % (priv_string,db_table,user,host)
|
query = "GRANT %s ON %s TO '%s'@'%s'" % (priv_string,db_table,user,host)
|
||||||
if 'GRANT' in priv:
|
if 'GRANT' in priv:
|
||||||
query = query + " WITH GRANT OPTION"
|
query = query + " WITH GRANT OPTION"
|
||||||
|
|
||||||
cursor.execute(query)
|
cursor.execute(query)
|
||||||
|
|
||||||
def load_mycnf():
|
def load_mycnf():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue