mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Reformat everything.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user