mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-06-06 00:07:12 +00:00
multiple: replace namedtuple with dataclass (#12094)
* refactor(multiple): replace namedtuple with dataclass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(changelog): add fragment for PR 12094 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Update comment. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
850ef03fe7
commit
cbc6f6eed3
6 changed files with 47 additions and 20 deletions
|
|
@ -688,13 +688,21 @@ import copy
|
|||
import os
|
||||
import re
|
||||
import time
|
||||
from collections import namedtuple
|
||||
from dataclasses import dataclass
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.common.dict_transformations import dict_merge
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils._opennebula import flatten, render
|
||||
|
||||
|
||||
@dataclass
|
||||
class AuthParams:
|
||||
url: str
|
||||
username: str
|
||||
password: str
|
||||
|
||||
|
||||
# Updateconf attributes documentation: https://docs.opennebula.io/6.10/integration_and_development/system_interfaces/api.html#one-vm-updateconf
|
||||
UPDATECONF_ATTRIBUTES = {
|
||||
"OS": ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "SD_DISK_BUS", "UUID", "FIRMWARE"],
|
||||
|
|
@ -1632,9 +1640,7 @@ def get_connection_info(module):
|
|||
if not url:
|
||||
module.fail_json(msg="Opennebula API url (api_url) is not specified")
|
||||
|
||||
auth_params = namedtuple("auth", ("url", "username", "password"))
|
||||
|
||||
return auth_params(url=url, username=username, password=password)
|
||||
return AuthParams(url=url, username=username, password=password)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue