1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-26 13:42:49 +00:00

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

@ -70,14 +70,13 @@ from ansible.module_utils.basic import AnsibleModule
class ImageFacts:
def __init__(self, module):
self.module = module
self.filters = module.params['filters']
self.filters = module.params["filters"]
def return_all_installed_images(self):
cmd = [self.module.get_bin_path('imgadm'), 'list', '-j']
cmd = [self.module.get_bin_path("imgadm"), "list", "-j"]
if self.filters:
cmd.append(self.filters)
@ -85,17 +84,16 @@ class ImageFacts:
(rc, out, err) = self.module.run_command(cmd)
if rc != 0:
self.module.exit_json(
msg='Failed to get all installed images', stderr=err)
self.module.exit_json(msg="Failed to get all installed images", stderr=err)
images = json.loads(out)
result = {}
for image in images:
result[image['manifest']['uuid']] = image['manifest']
result[image["manifest"]["uuid"]] = image["manifest"]
# Merge additional attributes with the image manifest.
for attrib in ['clones', 'source', 'zpool']:
result[image['manifest']['uuid']][attrib] = image[attrib]
for attrib in ["clones", "source", "zpool"]:
result[image["manifest"]["uuid"]][attrib] = image[attrib]
return result
@ -115,5 +113,5 @@ def main():
module.exit_json(**data)
if __name__ == '__main__':
if __name__ == "__main__":
main()