mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00:00
Cleanup: use super() instead of super(__class__, self) (#11016)
* Address UP008: Use super() instead of super(__class__, self). * Linting.
This commit is contained in:
@@ -484,7 +484,7 @@ class Archive(metaclass=abc.ABCMeta):
|
||||
|
||||
class ZipArchive(Archive):
|
||||
def __init__(self, module):
|
||||
super(ZipArchive, self).__init__(module)
|
||||
super().__init__(module)
|
||||
|
||||
def close(self):
|
||||
self.file.close()
|
||||
@@ -515,7 +515,7 @@ class ZipArchive(Archive):
|
||||
|
||||
class TarArchive(Archive):
|
||||
def __init__(self, module):
|
||||
super(TarArchive, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.fileIO = None
|
||||
|
||||
def close(self):
|
||||
|
||||
@@ -201,7 +201,7 @@ class BitBucketPipelineVariable(AnsibleModule):
|
||||
params = _load_params() or {}
|
||||
if params.get('secured'):
|
||||
kwargs['argument_spec']['value'].update({'no_log': True})
|
||||
super(BitBucketPipelineVariable, self).__init__(*args, **kwargs)
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -206,7 +206,7 @@ class ConsulAgentCheckModule(_ConsulModule):
|
||||
if operation == OPERATION_DELETE:
|
||||
return f"{self.api_endpoint}/deregister/{identifier}"
|
||||
|
||||
return super(ConsulAgentCheckModule, self).endpoint_url(operation, identifier)
|
||||
return super().endpoint_url(operation, identifier)
|
||||
|
||||
def read_object(self):
|
||||
url = self.endpoint_url(OPERATION_READ)
|
||||
@@ -217,7 +217,7 @@ class ConsulAgentCheckModule(_ConsulModule):
|
||||
return None
|
||||
|
||||
def prepare_object(self, existing, obj):
|
||||
existing = super(ConsulAgentCheckModule, self).prepare_object(existing, obj)
|
||||
existing = super().prepare_object(existing, obj)
|
||||
validate_check(existing)
|
||||
return existing
|
||||
|
||||
|
||||
@@ -234,10 +234,10 @@ class ConsulAgentServiceModule(_ConsulModule):
|
||||
if operation == OPERATION_DELETE:
|
||||
return f"{self.api_endpoint}/deregister/{identifier}"
|
||||
|
||||
return super(ConsulAgentServiceModule, self).endpoint_url(operation, identifier)
|
||||
return super().endpoint_url(operation, identifier)
|
||||
|
||||
def prepare_object(self, existing, obj):
|
||||
existing = super(ConsulAgentServiceModule, self).prepare_object(existing, obj)
|
||||
existing = super().prepare_object(existing, obj)
|
||||
if "ServicePort" in existing:
|
||||
existing["Port"] = existing.pop("ServicePort")
|
||||
|
||||
@@ -257,7 +257,7 @@ class ConsulAgentServiceModule(_ConsulModule):
|
||||
if "ServicePort" in module_obj:
|
||||
module_obj["Port"] = module_obj.pop("ServicePort")
|
||||
|
||||
return super(ConsulAgentServiceModule, self).needs_update(api_obj, module_obj)
|
||||
return super().needs_update(api_obj, module_obj)
|
||||
|
||||
def delete_object(self, obj):
|
||||
if not self._module.check_mode:
|
||||
|
||||
@@ -170,12 +170,12 @@ class ConsulAuthMethodModule(_ConsulModule):
|
||||
def map_param(self, k, v, is_update):
|
||||
if k == "config" and v:
|
||||
v = {camel_case_key(k2): v2 for k2, v2 in v.items()}
|
||||
return super(ConsulAuthMethodModule, self).map_param(k, v, is_update)
|
||||
return super().map_param(k, v, is_update)
|
||||
|
||||
def needs_update(self, api_obj, module_obj):
|
||||
if "MaxTokenTTL" in module_obj:
|
||||
module_obj["MaxTokenTTL"] = normalize_ttl(module_obj["MaxTokenTTL"])
|
||||
return super(ConsulAuthMethodModule, self).needs_update(api_obj, module_obj)
|
||||
return super().needs_update(api_obj, module_obj)
|
||||
|
||||
|
||||
_ARGUMENT_SPEC = {
|
||||
|
||||
@@ -141,12 +141,12 @@ class ConsulBindingRuleModule(_ConsulModule):
|
||||
raise
|
||||
|
||||
def module_to_obj(self, is_update):
|
||||
obj = super(ConsulBindingRuleModule, self).module_to_obj(is_update)
|
||||
obj = super().module_to_obj(is_update)
|
||||
del obj["Name"]
|
||||
return obj
|
||||
|
||||
def prepare_object(self, existing, obj):
|
||||
final = super(ConsulBindingRuleModule, self).prepare_object(existing, obj)
|
||||
final = super().prepare_object(existing, obj)
|
||||
name = self.params["name"]
|
||||
description = final.pop("Description", "").split(": ", 1)[-1]
|
||||
final["Description"] = f"{name}: {description}"
|
||||
|
||||
@@ -146,7 +146,7 @@ class ConsulPolicyModule(_ConsulModule):
|
||||
def endpoint_url(self, operation, identifier=None):
|
||||
if operation == OPERATION_READ:
|
||||
return [self.api_endpoint, "name", self.params["name"]]
|
||||
return super(ConsulPolicyModule, self).endpoint_url(operation, identifier)
|
||||
return super().endpoint_url(operation, identifier)
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -217,7 +217,7 @@ class ConsulRoleModule(_ConsulModule):
|
||||
def endpoint_url(self, operation, identifier=None):
|
||||
if operation == OPERATION_READ:
|
||||
return [self.api_endpoint, "name", self.params["name"]]
|
||||
return super(ConsulRoleModule, self).endpoint_url(operation, identifier)
|
||||
return super().endpoint_url(operation, identifier)
|
||||
|
||||
|
||||
NAME_ID_SPEC = dict(
|
||||
|
||||
@@ -236,7 +236,7 @@ class ConsulTokenModule(_ConsulModule):
|
||||
# if `accessor_id` is not supplied we can only create objects and are not idempotent
|
||||
if not self.id_from_obj(self.params):
|
||||
return None
|
||||
return super(ConsulTokenModule, self).read_object()
|
||||
return super().read_object()
|
||||
|
||||
def needs_update(self, api_obj, module_obj):
|
||||
# SecretID is usually not supplied
|
||||
@@ -248,7 +248,7 @@ class ConsulTokenModule(_ConsulModule):
|
||||
# it writes to ExpirationTime, so we need to remove that as well
|
||||
if "ExpirationTTL" in module_obj:
|
||||
del module_obj["ExpirationTTL"]
|
||||
return super(ConsulTokenModule, self).needs_update(api_obj, module_obj)
|
||||
return super().needs_update(api_obj, module_obj)
|
||||
|
||||
|
||||
NAME_ID_SPEC = dict(
|
||||
|
||||
@@ -289,7 +289,7 @@ class Options(dict):
|
||||
"""opts_string looks like: 'discard,foo=bar,baz=greeble' """
|
||||
|
||||
def __init__(self, opts_string):
|
||||
super(Options, self).__init__()
|
||||
super().__init__()
|
||||
self.itemlist = []
|
||||
if opts_string is not None:
|
||||
for opt in opts_string.split(','):
|
||||
@@ -334,11 +334,11 @@ class Options(dict):
|
||||
def __setitem__(self, key, value):
|
||||
if key not in self:
|
||||
self.itemlist.append(key)
|
||||
super(Options, self).__setitem__(key, value)
|
||||
super().__setitem__(key, value)
|
||||
|
||||
def __delitem__(self, key):
|
||||
self.itemlist.remove(key)
|
||||
super(Options, self).__delitem__(key)
|
||||
super().__delitem__(key)
|
||||
|
||||
def __ne__(self, obj):
|
||||
return not (isinstance(obj, Options) and sorted(self.items()) == sorted(obj.items()))
|
||||
|
||||
@@ -138,7 +138,7 @@ class DimensionDataNetworkModule(DimensionDataModule):
|
||||
Create a new Dimension Data network module.
|
||||
"""
|
||||
|
||||
super(DimensionDataNetworkModule, self).__init__(
|
||||
super().__init__(
|
||||
module=AnsibleModule(
|
||||
argument_spec=DimensionDataModule.argument_spec_with_wait(
|
||||
name=dict(type='str', required=True),
|
||||
|
||||
@@ -180,7 +180,7 @@ class DimensionDataVlanModule(DimensionDataModule):
|
||||
Create a new Dimension Data VLAN module.
|
||||
"""
|
||||
|
||||
super(DimensionDataVlanModule, self).__init__(
|
||||
super().__init__(
|
||||
module=AnsibleModule(
|
||||
argument_spec=DimensionDataModule.argument_spec_with_wait(
|
||||
name=dict(required=True, type='str'),
|
||||
|
||||
@@ -444,7 +444,7 @@ class Btrfs(Filesystem):
|
||||
GROW_MOUNTPOINT_ONLY = True
|
||||
|
||||
def __init__(self, module):
|
||||
super(Btrfs, self).__init__(module)
|
||||
super().__init__(module)
|
||||
mkfs = self.module.get_bin_path(self.MKFS, required=True)
|
||||
dummy, stdout, stderr = self.module.run_command([mkfs, '--version'], check_rc=True)
|
||||
match = re.search(r" v([0-9.]+)", stdout)
|
||||
@@ -485,7 +485,7 @@ class F2fs(Filesystem):
|
||||
GROW = 'resize.f2fs'
|
||||
|
||||
def __init__(self, module):
|
||||
super(F2fs, self).__init__(module)
|
||||
super().__init__(module)
|
||||
mkfs = self.module.get_bin_path(self.MKFS, required=True)
|
||||
dummy, out, dummy = self.module.run_command([mkfs, os.devnull], check_rc=False, environ_update=self.LANG_ENV)
|
||||
# Looking for " F2FS-tools: mkfs.f2fs Ver: 1.10.0 (2018-01-30)"
|
||||
@@ -523,7 +523,7 @@ class VFAT(Filesystem):
|
||||
GROW_MAX_SPACE_FLAGS = ['-s', 'max']
|
||||
|
||||
def __init__(self, module):
|
||||
super(VFAT, self).__init__(module)
|
||||
super().__init__(module)
|
||||
if platform.system() == 'FreeBSD':
|
||||
self.MKFS = 'newfs_msdos'
|
||||
else:
|
||||
|
||||
@@ -236,7 +236,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class ConfigIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(ConfigIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def config_show(self):
|
||||
return self._post_json(method='config_show', name=None)
|
||||
|
||||
@@ -204,7 +204,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class DNSRecordIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(DNSRecordIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def dnsrecord_find(self, zone_name, record_name):
|
||||
if record_name == '@':
|
||||
|
||||
@@ -91,7 +91,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class DNSZoneIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(DNSZoneIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def dnszone_find(self, zone_name, details=None):
|
||||
items = {'all': 'true',
|
||||
|
||||
@@ -177,7 +177,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class GroupIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(GroupIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def group_find(self, name):
|
||||
return self._post_json(method='group_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -163,7 +163,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L
|
||||
|
||||
class HBACRuleIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(HBACRuleIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def hbacrule_find(self, name):
|
||||
return self._post_json(method='hbacrule_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -191,7 +191,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class HostIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(HostIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def host_show(self, name):
|
||||
return self._post_json(method='host_show', name=name)
|
||||
|
||||
@@ -104,7 +104,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class HostGroupIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(HostGroupIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def hostgroup_find(self, name):
|
||||
return self._post_json(method='hostgroup_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -87,7 +87,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class OTPConfigIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(OTPConfigIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def otpconfig_show(self):
|
||||
return self._post_json(method='otpconfig_show', name=None)
|
||||
|
||||
@@ -178,7 +178,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class OTPTokenIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(OTPTokenIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def otptoken_find(self, name):
|
||||
return self._post_json(method='otptoken_find', name=None, item={'all': True,
|
||||
|
||||
@@ -164,7 +164,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
class PwPolicyIPAClient(IPAClient):
|
||||
'''The global policy will be selected when `name` is `None`'''
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(PwPolicyIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def pwpolicy_find(self, name):
|
||||
if name is None:
|
||||
|
||||
@@ -140,7 +140,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class RoleIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(RoleIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def role_find(self, name):
|
||||
return self._post_json(method='role_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -99,7 +99,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class ServiceIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(ServiceIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def service_find(self, name):
|
||||
return self._post_json(method='service_find', name=None, item={'all': True, 'krbcanonicalname': name})
|
||||
|
||||
@@ -87,7 +87,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L
|
||||
|
||||
class SubCAIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(SubCAIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def subca_find(self, subca_name):
|
||||
return self._post_json(method='ca_find', name=subca_name, item=None)
|
||||
|
||||
@@ -72,7 +72,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class SudoCmdIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(SudoCmdIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def sudocmd_find(self, name):
|
||||
return self._post_json(method='sudocmd_find', name=None, item={'all': True, 'sudocmd': name})
|
||||
|
||||
@@ -81,7 +81,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class SudoCmdGroupIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(SudoCmdGroupIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def sudocmdgroup_find(self, name):
|
||||
return self._post_json(method='sudocmdgroup_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -205,7 +205,7 @@ from ansible_collections.community.general.plugins.module_utils.version import L
|
||||
|
||||
class SudoRuleIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(SudoRuleIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def sudorule_find(self, name):
|
||||
return self._post_json(method='sudorule_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -188,7 +188,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class UserIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(UserIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def user_find(self, name):
|
||||
return self._post_json(method='user_find', name=None, item={'all': True, 'uid': name})
|
||||
|
||||
@@ -143,7 +143,7 @@ from ansible.module_utils.common.text.converters import to_native
|
||||
|
||||
class VaultIPAClient(IPAClient):
|
||||
def __init__(self, module, host, port, protocol):
|
||||
super(VaultIPAClient, self).__init__(module, host, port, protocol)
|
||||
super().__init__(module, host, port, protocol)
|
||||
|
||||
def vault_find(self, name):
|
||||
return self._post_json(method='vault_find', name=None, item={'all': True, 'cn': name})
|
||||
|
||||
@@ -354,7 +354,7 @@ class LaunchCtlTask(metaclass=ABCMeta):
|
||||
|
||||
class LaunchCtlStart(LaunchCtlTask):
|
||||
def __init__(self, module, service, plist):
|
||||
super(LaunchCtlStart, self).__init__(module, service, plist)
|
||||
super().__init__(module, service, plist)
|
||||
|
||||
def runCommand(self):
|
||||
state, dummy, dummy, dummy = self.get_state()
|
||||
@@ -381,7 +381,7 @@ class LaunchCtlStart(LaunchCtlTask):
|
||||
|
||||
class LaunchCtlStop(LaunchCtlTask):
|
||||
def __init__(self, module, service, plist):
|
||||
super(LaunchCtlStop, self).__init__(module, service, plist)
|
||||
super().__init__(module, service, plist)
|
||||
|
||||
def runCommand(self):
|
||||
state, dummy, dummy, dummy = self.get_state()
|
||||
@@ -408,7 +408,7 @@ class LaunchCtlStop(LaunchCtlTask):
|
||||
|
||||
class LaunchCtlReload(LaunchCtlTask):
|
||||
def __init__(self, module, service, plist):
|
||||
super(LaunchCtlReload, self).__init__(module, service, plist)
|
||||
super().__init__(module, service, plist)
|
||||
|
||||
def runCommand(self):
|
||||
state, dummy, dummy, dummy = self.get_state()
|
||||
@@ -423,7 +423,7 @@ class LaunchCtlReload(LaunchCtlTask):
|
||||
|
||||
class LaunchCtlUnload(LaunchCtlTask):
|
||||
def __init__(self, module, service, plist):
|
||||
super(LaunchCtlUnload, self).__init__(module, service, plist)
|
||||
super().__init__(module, service, plist)
|
||||
|
||||
def runCommand(self):
|
||||
state, dummy, dummy, dummy = self.get_state()
|
||||
@@ -432,16 +432,16 @@ class LaunchCtlUnload(LaunchCtlTask):
|
||||
|
||||
class LaunchCtlRestart(LaunchCtlReload):
|
||||
def __init__(self, module, service, plist):
|
||||
super(LaunchCtlRestart, self).__init__(module, service, plist)
|
||||
super().__init__(module, service, plist)
|
||||
|
||||
def runCommand(self):
|
||||
super(LaunchCtlRestart, self).runCommand()
|
||||
super().runCommand()
|
||||
self.start()
|
||||
|
||||
|
||||
class LaunchCtlList(LaunchCtlTask):
|
||||
def __init__(self, module, service):
|
||||
super(LaunchCtlList, self).__init__(module, service, None)
|
||||
super().__init__(module, service, None)
|
||||
|
||||
def runCommand(self):
|
||||
# Do nothing, the list functionality is done by the
|
||||
|
||||
@@ -81,7 +81,7 @@ class StatusValue(namedtuple("Status", "value, is_pending")):
|
||||
]
|
||||
|
||||
def __new__(cls, value, is_pending=False):
|
||||
return super(StatusValue, cls).__new__(cls, value, is_pending)
|
||||
return super().__new__(cls, value, is_pending)
|
||||
|
||||
def pending(self):
|
||||
return StatusValue(self.value, True)
|
||||
|
||||
@@ -128,7 +128,7 @@ class DatacenterInfoModule(OneViewModuleBase):
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(DatacenterInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=self.argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -182,7 +182,7 @@ class EnclosureInfoModule(OneViewModuleBase):
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(EnclosureInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=self.argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -147,7 +147,7 @@ class EthernetNetworkModule(OneViewModuleBase):
|
||||
data=dict(type='dict', required=True),
|
||||
)
|
||||
|
||||
super(EthernetNetworkModule, self).__init__(additional_arg_spec=argument_spec, validate_etag_support=True)
|
||||
super().__init__(additional_arg_spec=argument_spec, validate_etag_support=True)
|
||||
|
||||
self.resource_client = self.oneview_client.ethernet_networks
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ class EthernetNetworkInfoModule(OneViewModuleBase):
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(EthernetNetworkInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=self.argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -98,8 +98,7 @@ class FcNetworkModule(OneViewModuleBase):
|
||||
required=True,
|
||||
choices=['present', 'absent']))
|
||||
|
||||
super(FcNetworkModule, self).__init__(additional_arg_spec=additional_arg_spec,
|
||||
validate_etag_support=True)
|
||||
super().__init__(additional_arg_spec=additional_arg_spec, validate_etag_support=True)
|
||||
|
||||
self.resource_client = self.oneview_client.fc_networks
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class FcNetworkInfoModule(OneViewModuleBase):
|
||||
params=dict(type='dict')
|
||||
)
|
||||
|
||||
super(FcNetworkInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -94,8 +94,7 @@ class FcoeNetworkModule(OneViewModuleBase):
|
||||
state=dict(default='present',
|
||||
choices=['present', 'absent']))
|
||||
|
||||
super(FcoeNetworkModule, self).__init__(additional_arg_spec=additional_arg_spec,
|
||||
validate_etag_support=True)
|
||||
super().__init__(additional_arg_spec=additional_arg_spec, validate_etag_support=True)
|
||||
|
||||
self.resource_client = self.oneview_client.fcoe_networks
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class FcoeNetworkInfoModule(OneViewModuleBase):
|
||||
params=dict(type='dict'),
|
||||
)
|
||||
|
||||
super(FcoeNetworkInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -119,8 +119,7 @@ class LogicalInterconnectGroupModule(OneViewModuleBase):
|
||||
data=dict(required=True, type='dict')
|
||||
)
|
||||
|
||||
super(LogicalInterconnectGroupModule, self).__init__(additional_arg_spec=argument_spec,
|
||||
validate_etag_support=True)
|
||||
super().__init__(additional_arg_spec=argument_spec, validate_etag_support=True)
|
||||
self.resource_client = self.oneview_client.logical_interconnect_groups
|
||||
|
||||
def execute_module(self):
|
||||
|
||||
@@ -101,7 +101,7 @@ class LogicalInterconnectGroupInfoModule(OneViewModuleBase):
|
||||
params=dict(type='dict'),
|
||||
)
|
||||
|
||||
super(LogicalInterconnectGroupInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -109,8 +109,7 @@ class NetworkSetModule(OneViewModuleBase):
|
||||
data=dict(required=True, type='dict'))
|
||||
|
||||
def __init__(self):
|
||||
super(NetworkSetModule, self).__init__(additional_arg_spec=self.argument_spec,
|
||||
validate_etag_support=True)
|
||||
super().__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True)
|
||||
self.resource_client = self.oneview_client.network_sets
|
||||
|
||||
def execute_module(self):
|
||||
|
||||
@@ -141,7 +141,7 @@ class NetworkSetInfoModule(OneViewModuleBase):
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(NetworkSetInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=self.argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -145,7 +145,7 @@ class SanManagerModule(OneViewModuleBase):
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(SanManagerModule, self).__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True)
|
||||
super().__init__(additional_arg_spec=self.argument_spec, validate_etag_support=True)
|
||||
self.resource_client = self.oneview_client.san_managers
|
||||
|
||||
def execute_module(self):
|
||||
|
||||
@@ -95,7 +95,7 @@ class SanManagerInfoModule(OneViewModuleBase):
|
||||
)
|
||||
|
||||
def __init__(self):
|
||||
super(SanManagerInfoModule, self).__init__(
|
||||
super().__init__(
|
||||
additional_arg_spec=self.argument_spec,
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
@@ -137,7 +137,7 @@ from ansible_collections.community.general.plugins.module_utils.online import (
|
||||
class OnlineServerInfo(Online):
|
||||
|
||||
def __init__(self, module):
|
||||
super(OnlineServerInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'api/v1/server'
|
||||
|
||||
def _get_server_detail(self, server_path):
|
||||
|
||||
@@ -54,7 +54,7 @@ from ansible_collections.community.general.plugins.module_utils.online import (
|
||||
class OnlineUserInfo(Online):
|
||||
|
||||
def __init__(self, module):
|
||||
super(OnlineUserInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'api/v1/user'
|
||||
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@ class PamdEmptyLine(PamdLine):
|
||||
class PamdComment(PamdLine):
|
||||
|
||||
def __init__(self, line):
|
||||
super(PamdComment, self).__init__(line)
|
||||
super().__init__(line)
|
||||
|
||||
@property
|
||||
def is_valid(self):
|
||||
@@ -288,7 +288,7 @@ class PamdComment(PamdLine):
|
||||
|
||||
class PamdInclude(PamdLine):
|
||||
def __init__(self, line):
|
||||
super(PamdInclude, self).__init__(line)
|
||||
super().__init__(line)
|
||||
|
||||
@property
|
||||
def is_valid(self):
|
||||
|
||||
@@ -139,7 +139,7 @@ class PSAdapter(metaclass=abc.ABCMeta):
|
||||
|
||||
class PSAdapter100(PSAdapter):
|
||||
def __init__(self, psutil):
|
||||
super(PSAdapter100, self).__init__(psutil)
|
||||
super().__init__(psutil)
|
||||
|
||||
@staticmethod
|
||||
def _get_attribute_from_proc(proc, attribute):
|
||||
@@ -148,7 +148,7 @@ class PSAdapter100(PSAdapter):
|
||||
|
||||
class PSAdapter200(PSAdapter):
|
||||
def __init__(self, psutil):
|
||||
super(PSAdapter200, self).__init__(psutil)
|
||||
super().__init__(psutil)
|
||||
|
||||
@staticmethod
|
||||
def _get_attribute_from_proc(proc, attribute):
|
||||
@@ -158,7 +158,7 @@ class PSAdapter200(PSAdapter):
|
||||
|
||||
class PSAdapter530(PSAdapter):
|
||||
def __init__(self, psutil):
|
||||
super(PSAdapter530, self).__init__(psutil)
|
||||
super().__init__(psutil)
|
||||
|
||||
def _process_iter(self, *attrs):
|
||||
return self._psutil.process_iter(attrs=attrs)
|
||||
|
||||
@@ -107,7 +107,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewayImageInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewayImageInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'images'
|
||||
|
||||
region = module.params["region"]
|
||||
|
||||
@@ -91,7 +91,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewayIpInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewayIpInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'ips'
|
||||
|
||||
region = module.params["region"]
|
||||
|
||||
@@ -82,7 +82,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewayOrganizationInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewayOrganizationInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'organizations'
|
||||
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewaySecurityGroupInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewaySecurityGroupInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'security_groups'
|
||||
|
||||
region = module.params["region"]
|
||||
|
||||
@@ -177,7 +177,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewayServerInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewayServerInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'servers'
|
||||
|
||||
region = module.params["region"]
|
||||
|
||||
@@ -95,7 +95,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewaySnapshotInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewaySnapshotInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'snapshots'
|
||||
|
||||
region = module.params["region"]
|
||||
|
||||
@@ -90,7 +90,7 @@ from ansible_collections.community.general.plugins.module_utils.scaleway import
|
||||
class ScalewayVolumeInfo(Scaleway):
|
||||
|
||||
def __init__(self, module):
|
||||
super(ScalewayVolumeInfo, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.name = 'volumes'
|
||||
|
||||
region = module.params["region"]
|
||||
|
||||
@@ -132,7 +132,7 @@ class Timezone:
|
||||
Args:
|
||||
module: The AnsibleModule.
|
||||
"""
|
||||
super(Timezone, self).__init__()
|
||||
super().__init__()
|
||||
self.msg = []
|
||||
# `self.value` holds the values for each params on each phases.
|
||||
# Initially there's only info of "planned" phase, but the
|
||||
@@ -266,7 +266,7 @@ class SystemdTimezone(Timezone):
|
||||
)
|
||||
|
||||
def __init__(self, module):
|
||||
super(SystemdTimezone, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.timedatectl = module.get_bin_path('timedatectl', required=True)
|
||||
self.status = dict()
|
||||
# Validate given timezone
|
||||
@@ -339,7 +339,7 @@ class NosystemdTimezone(Timezone):
|
||||
)
|
||||
|
||||
def __init__(self, module):
|
||||
super(NosystemdTimezone, self).__init__(module)
|
||||
super().__init__(module)
|
||||
# Validate given timezone
|
||||
planned_tz = ''
|
||||
if 'name' in self.value:
|
||||
@@ -592,7 +592,7 @@ class SmartOSTimezone(Timezone):
|
||||
"""
|
||||
|
||||
def __init__(self, module):
|
||||
super(SmartOSTimezone, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.settimezone = self.module.get_bin_path('sm-set-timezone', required=False)
|
||||
if not self.settimezone:
|
||||
module.fail_json(msg='sm-set-timezone not found. Make sure the smtools package is installed.')
|
||||
@@ -645,7 +645,7 @@ class DarwinTimezone(Timezone):
|
||||
)
|
||||
|
||||
def __init__(self, module):
|
||||
super(DarwinTimezone, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.systemsetup = module.get_bin_path('systemsetup', required=True)
|
||||
self.status = dict()
|
||||
# Validate given timezone
|
||||
@@ -690,7 +690,7 @@ class BSDTimezone(Timezone):
|
||||
"""
|
||||
|
||||
def __init__(self, module):
|
||||
super(BSDTimezone, self).__init__(module)
|
||||
super().__init__(module)
|
||||
|
||||
def __get_timezone(self):
|
||||
zoneinfo_dir = '/usr/share/zoneinfo/'
|
||||
@@ -780,7 +780,7 @@ class AIXTimezone(Timezone):
|
||||
"""
|
||||
|
||||
def __init__(self, module):
|
||||
super(AIXTimezone, self).__init__(module)
|
||||
super().__init__(module)
|
||||
self.settimezone = self.module.get_bin_path('chtz', required=True)
|
||||
|
||||
def __get_timezone(self):
|
||||
|
||||
@@ -565,7 +565,7 @@ class XenServerVM(XenServerObject):
|
||||
Args:
|
||||
module: Reference to Ansible module object.
|
||||
"""
|
||||
super(XenServerVM, self).__init__(module)
|
||||
super().__init__(module)
|
||||
|
||||
self.vm_ref = get_object_ref(self.module, self.module.params['name'], self.module.params['uuid'], obj_type="VM", fail=False, msg_prefix="VM search: ")
|
||||
self.gather_params()
|
||||
|
||||
@@ -168,7 +168,7 @@ class XenServerVM(XenServerObject):
|
||||
Args:
|
||||
module: Reference to AnsibleModule object.
|
||||
"""
|
||||
super(XenServerVM, self).__init__(module)
|
||||
super().__init__(module)
|
||||
|
||||
self.vm_ref = get_object_ref(self.module, self.module.params['name'], self.module.params['uuid'], obj_type="VM", fail=True, msg_prefix="VM search: ")
|
||||
self.gather_params()
|
||||
|
||||
@@ -196,7 +196,7 @@ class XenServerVM(XenServerObject):
|
||||
Args:
|
||||
module: Reference to Ansible module object.
|
||||
"""
|
||||
super(XenServerVM, self).__init__(module)
|
||||
super().__init__(module)
|
||||
|
||||
self.vm_ref = get_object_ref(self.module, self.module.params['name'], self.module.params['uuid'], obj_type="VM", fail=True, msg_prefix="VM search: ")
|
||||
self.gather_params()
|
||||
|
||||
Reference in New Issue
Block a user