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

@ -115,11 +115,7 @@ from ansible_collections.community.general.plugins.module_utils.oneview import O
class EthernetNetworkInfoModule(OneViewModuleBase):
argument_spec = dict(
name=dict(type='str'),
options=dict(type='list', elements='str'),
params=dict(type='dict')
)
argument_spec = dict(name=dict(type="str"), options=dict(type="list", elements="str"), params=dict(type="dict"))
def __init__(self):
super().__init__(
@ -131,35 +127,34 @@ class EthernetNetworkInfoModule(OneViewModuleBase):
def execute_module(self):
info = {}
if self.module.params['name']:
ethernet_networks = self.resource_client.get_by('name', self.module.params['name'])
if self.module.params["name"]:
ethernet_networks = self.resource_client.get_by("name", self.module.params["name"])
if self.module.params.get('options') and ethernet_networks:
if self.module.params.get("options") and ethernet_networks:
info = self.__gather_optional_info(ethernet_networks[0])
else:
ethernet_networks = self.resource_client.get_all(**self.facts_params)
info['ethernet_networks'] = ethernet_networks
info["ethernet_networks"] = ethernet_networks
return dict(changed=False, **info)
def __gather_optional_info(self, ethernet_network):
info = {}
if self.options.get('associatedProfiles'):
info['enet_associated_profiles'] = self.__get_associated_profiles(ethernet_network)
if self.options.get('associatedUplinkGroups'):
info['enet_associated_uplink_groups'] = self.__get_associated_uplink_groups(ethernet_network)
if self.options.get("associatedProfiles"):
info["enet_associated_profiles"] = self.__get_associated_profiles(ethernet_network)
if self.options.get("associatedUplinkGroups"):
info["enet_associated_uplink_groups"] = self.__get_associated_uplink_groups(ethernet_network)
return info
def __get_associated_profiles(self, ethernet_network):
associated_profiles = self.resource_client.get_associated_profiles(ethernet_network['uri'])
associated_profiles = self.resource_client.get_associated_profiles(ethernet_network["uri"])
return [self.oneview_client.server_profiles.get(x) for x in associated_profiles]
def __get_associated_uplink_groups(self, ethernet_network):
uplink_groups = self.resource_client.get_associated_uplink_groups(ethernet_network['uri'])
uplink_groups = self.resource_client.get_associated_uplink_groups(ethernet_network["uri"])
return [self.oneview_client.uplink_sets.get(x) for x in uplink_groups]
@ -167,5 +162,5 @@ def main():
EthernetNetworkInfoModule().run()
if __name__ == '__main__':
if __name__ == "__main__":
main()