diff options
author | Rohit Thakur <rohitthakur2590@outlook.com> | 2020-05-04 09:49:22 +0530 |
---|---|---|
committer | Rohit Thakur <rohitthakur2590@outlook.com> | 2020-05-04 09:49:22 +0530 |
commit | fb6934cf290a3020bed292ae4f7dae7bd2ab28cf (patch) | |
tree | 7363aa30c9b65e01bf02716aa14605ff43428ff5 /plugins | |
parent | 7344ffc5dc646bbb362c5cd157a1828c3d1537ec (diff) | |
download | vyos-ansible-old-fb6934cf290a3020bed292ae4f7dae7bd2ab28cf.tar.gz vyos-ansible-old-fb6934cf290a3020bed292ae4f7dae7bd2ab28cf.zip |
tox linters fix
Signed-off-by: Rohit Thakur <rohitthakur2590@outlook.com>
Diffstat (limited to 'plugins')
3 files changed, 28 insertions, 44 deletions
diff --git a/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py b/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py index 141fedc..fd8b612 100644 --- a/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py +++ b/plugins/module_utils/network/vyos/argspec/interfaces/interfaces.py @@ -31,6 +31,7 @@ __metaclass__ = type class InterfacesArgs(object): # pylint: disable=R0903 """The arg spec for the vyos_interfaces module """ + def __init__(self, **kwargs): pass @@ -38,23 +39,11 @@ class InterfacesArgs(object): # pylint: disable=R0903 "config": { "elements": "dict", "options": { - "description": { - "type": "str" - }, - "duplex": { - "choices": ["full", "half", "auto"] - }, - "enabled": { - "default": True, - "type": "bool" - }, - "mtu": { - "type": "int" - }, - "name": { - "required": True, - "type": "str" - }, + "description": {"type": "str"}, + "duplex": {"choices": ["full", "half", "auto"]}, + "enabled": {"default": True, "type": "bool"}, + "mtu": {"type": "int"}, + "name": {"required": True, "type": "str"}, "speed": { "choices": ["auto", "10", "100", "1000", "2500", "10000"], "type": "str", @@ -62,19 +51,10 @@ class InterfacesArgs(object): # pylint: disable=R0903 "vifs": { "elements": "dict", "options": { - "vlan_id": { - "type": "int" - }, - "description": { - "type": "str" - }, - "enabled": { - "default": True, - "type": "bool" - }, - "mtu": { - "type": "int" - }, + "vlan_id": {"type": "int"}, + "description": {"type": "str"}, + "enabled": {"default": True, "type": "bool"}, + "mtu": {"type": "int"}, }, "type": "list", }, @@ -84,12 +64,15 @@ class InterfacesArgs(object): # pylint: disable=R0903 "running_config": {"type": "str"}, "state": { "choices": [ - "merged", "replaced", "overridden", "deleted", "rendered", - "parsed", "gathered" + "merged", + "replaced", + "overridden", + "deleted", + "rendered", + "parsed", + "gathered", ], - "default": - "merged", - "type": - "str", + "default": "merged", + "type": "str", }, } # pylint: disable=C0301 diff --git a/plugins/module_utils/network/vyos/config/interfaces/interfaces.py b/plugins/module_utils/network/vyos/config/interfaces/interfaces.py index 6d6bf77..51bf98e 100644 --- a/plugins/module_utils/network/vyos/config/interfaces/interfaces.py +++ b/plugins/module_utils/network/vyos/config/interfaces/interfaces.py @@ -57,9 +57,7 @@ class Interfaces(ConfigBase): facts, _warnings = Facts(self._module).get_facts( self.gather_subset, self.gather_network_resources, data=data ) - interfaces_facts = facts["ansible_network_resources"].get( - "interfaces" - ) + interfaces_facts = facts["ansible_network_resources"].get("interfaces") if not interfaces_facts: return [] return interfaces_facts @@ -99,9 +97,7 @@ class Interfaces(ConfigBase): self._module.fail_json( msg="value of running_config parameter must not be empty for state parsed" ) - result["parsed"] = self.get_interfaces_facts( - data=running_config - ) + result["parsed"] = self.get_interfaces_facts(data=running_config) else: changed_interfaces_facts = [] @@ -139,7 +135,10 @@ class Interfaces(ConfigBase): """ commands = [] - if self.state in ("merged", "replaced", "overridden", "rendered") and not want: + if ( + self.state in ("merged", "replaced", "overridden", "rendered") + and not want + ): self._module.fail_json( msg="value of config parameter must not be empty for state {0}".format( self.state diff --git a/plugins/modules/vyos_interfaces.py b/plugins/modules/vyos_interfaces.py index e2186e8..d15e5d7 100644 --- a/plugins/modules/vyos_interfaces.py +++ b/plugins/modules/vyos_interfaces.py @@ -37,7 +37,7 @@ ANSIBLE_METADATA = { } DOCUMENTATION = """module: vyos_interfaces -short_description: Manages attributes of interfaces for VyOS - interfaces resource module +short_description: Interfaces resource module description: - This module manages the interface attributes on VyOS network devices. - This module supports managing base attributes of Ethernet, Bonding, VXLAN, Loopback @@ -129,6 +129,8 @@ options: - The state I(parsed) reads the configuration from C(running_config) option and transforms it into Ansible structured data as per the resource module's argspec and the value is then returned in the I(parsed) key within the result. + type: str + version_added: "1.0.0" state: description: - The state of the configuration after module completion. |