mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup. * PEP 8 W293 whitespace cleanup. * Fix whitespace issue from recent PR.
This commit is contained in:
parent
802fbcadf8
commit
95789f3949
132 changed files with 287 additions and 313 deletions
|
@ -782,7 +782,7 @@ def get_cache(module):
|
|||
else:
|
||||
module.fail_json(msg=str(e))
|
||||
return cache
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
|
|
|
@ -110,7 +110,7 @@ def update_package_db(module):
|
|||
module.fail_json(msg="could not update package db: %s" % err)
|
||||
|
||||
def remove_packages(module, packages):
|
||||
|
||||
|
||||
remove_c = 0
|
||||
# Using a for loop in case of error, we can report the package that failed
|
||||
for package in packages:
|
||||
|
@ -122,7 +122,7 @@ def remove_packages(module, packages):
|
|||
|
||||
if rc != 0:
|
||||
module.fail_json(msg="failed to remove %s: %s" % (package, err))
|
||||
|
||||
|
||||
remove_c += 1
|
||||
|
||||
if remove_c > 0:
|
||||
|
@ -162,7 +162,7 @@ def main():
|
|||
state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']),
|
||||
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
|
||||
package = dict(aliases=['pkg', 'name'], required=True)))
|
||||
|
||||
|
||||
|
||||
if not os.path.exists(APT_PATH) or not os.path.exists(RPM_PATH):
|
||||
module.fail_json(msg="cannot find /usr/bin/apt-get and/or /usr/bin/rpm")
|
||||
|
@ -182,6 +182,6 @@ def main():
|
|||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -158,7 +158,7 @@ def install_overlay(module, name, list_url=None):
|
|||
|
||||
if layman.is_installed(name):
|
||||
return False
|
||||
|
||||
|
||||
if module.check_mode:
|
||||
mymsg = 'Would add layman repo \'' + name + '\''
|
||||
module.exit_json(changed=True, msg=mymsg)
|
||||
|
@ -195,7 +195,7 @@ def uninstall_overlay(module, name):
|
|||
|
||||
if not layman.is_installed(name):
|
||||
return False
|
||||
|
||||
|
||||
if module.check_mode:
|
||||
mymsg = 'Would remove layman repo \'' + name + '\''
|
||||
module.exit_json(changed=True, msg=mymsg)
|
||||
|
|
|
@ -144,18 +144,18 @@ def main():
|
|||
saturl = module.params['url']
|
||||
user = module.params['user']
|
||||
password = module.params['password']
|
||||
|
||||
|
||||
#initialize connection
|
||||
client = xmlrpclib.Server(saturl, verbose=0)
|
||||
session = client.auth.login(user, password)
|
||||
|
||||
|
||||
# get systemid
|
||||
sys_id = get_systemid(client, session, systname)
|
||||
|
||||
# get channels for system
|
||||
chans = base_channels(client, session, sys_id)
|
||||
|
||||
|
||||
|
||||
|
||||
if state == 'present':
|
||||
if channelname in chans:
|
||||
module.exit_json(changed=False, msg="Channel %s already exists" % channelname)
|
||||
|
|
|
@ -119,10 +119,10 @@ def update_package_db(module):
|
|||
rc, stdout, stderr = module.run_command(cmd, check_rc=False)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="could not update package db")
|
||||
|
||||
|
||||
|
||||
def remove_packages(module, packages):
|
||||
|
||||
|
||||
remove_c = 0
|
||||
# Using a for loop in case of error, we can report the package that failed
|
||||
for package in packages:
|
||||
|
@ -135,7 +135,7 @@ def remove_packages(module, packages):
|
|||
|
||||
if rc != 0:
|
||||
module.fail_json(msg="failed to remove %s" % (package))
|
||||
|
||||
|
||||
remove_c += 1
|
||||
|
||||
if remove_c > 0:
|
||||
|
@ -189,7 +189,7 @@ def main():
|
|||
force = dict(default=True, type='bool'),
|
||||
no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'),
|
||||
package = dict(aliases=['pkg', 'name'], required=True)))
|
||||
|
||||
|
||||
|
||||
if not os.path.exists(URPMI_PATH):
|
||||
module.fail_json(msg="cannot find urpmi, looking for %s" % (URPMI_PATH))
|
||||
|
@ -212,6 +212,6 @@ def main():
|
|||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -390,12 +390,12 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=None, di
|
|||
except Exception:
|
||||
e = get_exception()
|
||||
module.fail_json(msg="Failure talking to yum: %s" % e)
|
||||
|
||||
|
||||
return [ po_to_nevra(p) for p in pkgs ]
|
||||
|
||||
else:
|
||||
myrepoq = list(repoq)
|
||||
|
||||
|
||||
r_cmd = ['--disablerepo', ','.join(dis_repos)]
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
|
@ -442,7 +442,7 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=None, dis_r
|
|||
for pkg in pkgs:
|
||||
if pkg in updates:
|
||||
retpkgs.append(pkg)
|
||||
|
||||
|
||||
return set([ po_to_nevra(p) for p in retpkgs ])
|
||||
|
||||
else:
|
||||
|
@ -455,12 +455,12 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=None, dis_r
|
|||
|
||||
cmd = myrepoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec]
|
||||
rc,out,err = module.run_command(cmd)
|
||||
|
||||
|
||||
if rc == 0:
|
||||
return set([ p for p in out.split('\n') if p.strip() ])
|
||||
else:
|
||||
module.fail_json(msg='Error from repoquery: %s: %s' % (cmd, err))
|
||||
|
||||
|
||||
return set()
|
||||
|
||||
def what_provides(module, repoq, req_spec, conf_file, qf=def_qf, en_repos=None, dis_repos=None, installroot='/'):
|
||||
|
@ -725,7 +725,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, i
|
|||
if is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot):
|
||||
found = True
|
||||
res['results'].append('package providing %s is already installed' % (spec))
|
||||
|
||||
|
||||
if found:
|
||||
continue
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ def package_present(m, name, want_latest):
|
|||
|
||||
def package_update_all(m):
|
||||
"run update or patch on all available packages"
|
||||
|
||||
|
||||
retvals = {'rc': 0, 'stdout': '', 'stderr': ''}
|
||||
if m.params['type'] == 'patch':
|
||||
cmdname = 'patch'
|
||||
|
|
|
@ -142,7 +142,7 @@ EXAMPLES = '''
|
|||
- zypper_repository:
|
||||
repo: 'http://download.opensuse.org/repositories/systemsmanagement/openSUSE_Leap_42.1/'
|
||||
auto_import_keys: yes
|
||||
|
||||
|
||||
# Force refresh of a repository
|
||||
- zypper_repository:
|
||||
repo: 'http://my_internal_ci_repo/repo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue