1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-02-04 07:51:50 +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

@ -273,28 +273,37 @@ images:
from ansible_collections.community.general.plugins.module_utils.opennebula import OpenNebulaModule
IMAGE_STATES = ['INIT', 'READY', 'USED', 'DISABLED', 'LOCKED', 'ERROR', 'CLONE', 'DELETE', 'USED_PERS', 'LOCKED_USED', 'LOCKED_USED_PERS']
IMAGE_STATES = [
"INIT",
"READY",
"USED",
"DISABLED",
"LOCKED",
"ERROR",
"CLONE",
"DELETE",
"USED_PERS",
"LOCKED_USED",
"LOCKED_USED_PERS",
]
class ImageInfoModule(OpenNebulaModule):
def __init__(self):
argument_spec = dict(
ids=dict(type='list', aliases=['id'], elements='str'),
name=dict(type='str'),
ids=dict(type="list", aliases=["id"], elements="str"),
name=dict(type="str"),
)
mutually_exclusive = [
['ids', 'name'],
["ids", "name"],
]
OpenNebulaModule.__init__(self,
argument_spec,
supports_check_mode=True,
mutually_exclusive=mutually_exclusive)
OpenNebulaModule.__init__(self, argument_spec, supports_check_mode=True, mutually_exclusive=mutually_exclusive)
def run(self, one, module, result):
params = module.params
ids = params.get('ids')
name = params.get('name')
ids = params.get("ids")
name = params.get("name")
if ids:
images = self.get_images_by_ids(ids)
@ -303,9 +312,7 @@ class ImageInfoModule(OpenNebulaModule):
else:
images = self.get_all_images().IMAGE
self.result = {
'images': [self.get_image_info(image) for image in images]
}
self.result = {"images": [self.get_image_info(image) for image in images]}
self.exit()
@ -337,9 +344,10 @@ class ImageInfoModule(OpenNebulaModule):
pool = self.get_all_images()
if name_pattern.startswith('~'):
if name_pattern.startswith("~"):
import re
if name_pattern[1] == '*':
if name_pattern[1] == "*":
pattern = re.compile(name_pattern[2:], re.IGNORECASE)
else:
pattern = re.compile(name_pattern[1:])
@ -363,5 +371,5 @@ def main():
ImageInfoModule().run_module()
if __name__ == '__main__':
if __name__ == "__main__":
main()