Reformat everything.

This commit is contained in:
Felix Fontein
2025-11-01 12:08:41 +01:00
parent 3f2213791a
commit 340ff8586d
1008 changed files with 61301 additions and 58309 deletions

View File

@@ -78,12 +78,12 @@ with deps.declare("parseXML"):
from ansible.module_utils.basic import AnsibleModule
REPO_OPTS = ['alias', 'name', 'priority', 'enabled', 'autorefresh', 'gpgcheck']
REPO_OPTS = ["alias", "name", "priority", "enabled", "autorefresh", "gpgcheck"]
def _get_cmd(module, *args):
"""Combines the non-interactive zypper command with arguments/subcommands"""
cmd = [module.get_bin_path('zypper', required=True), '--quiet', '--non-interactive']
cmd = [module.get_bin_path("zypper", required=True), "--quiet", "--non-interactive"]
cmd.extend(args)
return cmd
@@ -91,18 +91,18 @@ def _get_cmd(module, *args):
def _parse_repos(module):
"""parses the output of zypper --xmlout repos and return a parse repo dictionary"""
cmd = _get_cmd(module, '--xmlout', 'repos')
cmd = _get_cmd(module, "--xmlout", "repos")
rc, stdout, stderr = module.run_command(cmd, check_rc=False)
if rc == 0:
repos = []
dom = parseXML(stdout)
repo_list = dom.getElementsByTagName('repo')
repo_list = dom.getElementsByTagName("repo")
for repo in repo_list:
opts = {}
for o in REPO_OPTS:
opts[o] = repo.getAttribute(o)
opts['url'] = repo.getElementsByTagName('url')[0].firstChild.data
opts["url"] = repo.getElementsByTagName("url")[0].firstChild.data
# A repo can be uniquely identified by an alias + url
repos.append(opts)
return repos
@@ -114,11 +114,7 @@ def _parse_repos(module):
def main():
module = AnsibleModule(
argument_spec=dict(
),
supports_check_mode=True
)
module = AnsibleModule(argument_spec=dict(), supports_check_mode=True)
deps.validate(parseXML)
@@ -126,5 +122,5 @@ def main():
module.exit_json(changed=False, repodatalist=repodatalist)
if __name__ == '__main__':
if __name__ == "__main__":
main()