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

@@ -92,54 +92,54 @@ def apt_repo(module, *args):
def add_repo(module, repo):
"""add a repository"""
apt_repo(module, 'add', repo)
apt_repo(module, "add", repo)
def rm_repo(module, repo):
"""remove a repository"""
apt_repo(module, 'rm', repo)
apt_repo(module, "rm", repo)
def set_repo(module, repo):
"""add a repository and remove other repositories"""
# first add to validate repository
apt_repo(module, 'add', repo)
apt_repo(module, 'rm', 'all')
apt_repo(module, 'add', repo)
apt_repo(module, "add", repo)
apt_repo(module, "rm", "all")
apt_repo(module, "add", repo)
def update(module):
"""update package cache"""
apt_repo(module, 'update')
apt_repo(module, "update")
def main():
module = AnsibleModule(
argument_spec=dict(
repo=dict(type='str', required=True),
state=dict(type='str', default='present', choices=['absent', 'present']),
remove_others=dict(type='bool', default=False),
update=dict(type='bool', default=False),
repo=dict(type="str", required=True),
state=dict(type="str", default="present", choices=["absent", "present"]),
remove_others=dict(type="bool", default=False),
update=dict(type="bool", default=False),
),
)
if not os.path.exists(APT_REPO_PATH):
module.fail_json(msg='cannot find /usr/bin/apt-repo')
module.fail_json(msg="cannot find /usr/bin/apt-repo")
params = module.params
repo = params['repo']
state = params['state']
repo = params["repo"]
state = params["state"]
old_repositories = apt_repo(module)
if state == 'present':
if params['remove_others']:
if state == "present":
if params["remove_others"]:
set_repo(module, repo)
else:
add_repo(module, repo)
elif state == 'absent':
elif state == "absent":
rm_repo(module, repo)
if params['update']:
if params["update"]:
update(module)
new_repositories = apt_repo(module)
@@ -147,5 +147,5 @@ def main():
module.exit_json(changed=changed, repo=repo, state=state)
if __name__ == '__main__':
if __name__ == "__main__":
main()