Remove unused imports / variables for junos (#60705)
* Remove unused imports / variables for junos This is to help with the migration to collections. Signed-off-by: Paul Belanger <pabelanger@redhat.com> * Remove duplicate execute_module() function for junos lacp_interfaces This seems to have passed lint checks, but something we caught in collection migration. Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
6a786d0d93
commit
c11d144302
8 changed files with 6 additions and 37 deletions
|
@ -14,7 +14,7 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
||||||
from ansible.module_utils.network.common.utils import to_list, get_xml_conf_arg
|
from ansible.module_utils.network.common.utils import to_list
|
||||||
from ansible.module_utils.network.junos.facts.facts import Facts
|
from ansible.module_utils.network.junos.facts.facts import Facts
|
||||||
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
||||||
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
||||||
|
@ -48,32 +48,6 @@ class Lacp_interfaces(ConfigBase):
|
||||||
return []
|
return []
|
||||||
return lacp_interfaces_facts
|
return lacp_interfaces_facts
|
||||||
|
|
||||||
def execute_module(self):
|
|
||||||
""" Execute the module
|
|
||||||
:rtype: A dictionary
|
|
||||||
:returns: The result from module execution
|
|
||||||
"""
|
|
||||||
result = {'changed': False}
|
|
||||||
commands = list()
|
|
||||||
warnings = list()
|
|
||||||
|
|
||||||
existing_lacp_interfaces_facts = self.get_lacp_interfaces_facts()
|
|
||||||
commands.extend(self.set_config(existing_lacp_interfaces_facts))
|
|
||||||
if commands:
|
|
||||||
if not self._module.check_mode:
|
|
||||||
self._connection.edit_config(commands)
|
|
||||||
result['changed'] = True
|
|
||||||
result['commands'] = commands
|
|
||||||
|
|
||||||
changed_lacp_interfaces_facts = self.get_lacp_interfaces_facts()
|
|
||||||
|
|
||||||
result['before'] = existing_lacp_interfaces_facts
|
|
||||||
if result['changed']:
|
|
||||||
result['after'] = changed_lacp_interfaces_facts
|
|
||||||
|
|
||||||
result['warnings'] = warnings
|
|
||||||
return result
|
|
||||||
|
|
||||||
def execute_module(self):
|
def execute_module(self):
|
||||||
""" Execute the module
|
""" Execute the module
|
||||||
:rtype: A dictionary
|
:rtype: A dictionary
|
||||||
|
|
|
@ -14,7 +14,7 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
||||||
from ansible.module_utils.network.common.utils import to_list, get_xml_conf_arg
|
from ansible.module_utils.network.common.utils import to_list
|
||||||
from ansible.module_utils.network.junos.facts.facts import Facts
|
from ansible.module_utils.network.junos.facts.facts import Facts
|
||||||
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
||||||
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
||||||
|
|
|
@ -17,7 +17,7 @@ from ansible.module_utils.network.common.cfg.base import ConfigBase
|
||||||
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
||||||
from ansible.module_utils.network.common.utils import to_list
|
from ansible.module_utils.network.common.utils import to_list
|
||||||
from ansible.module_utils.network.junos.facts.facts import Facts
|
from ansible.module_utils.network.junos.facts.facts import Facts
|
||||||
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node
|
||||||
|
|
||||||
|
|
||||||
class Lldp_global(ConfigBase):
|
class Lldp_global(ConfigBase):
|
||||||
|
|
|
@ -14,7 +14,7 @@ from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
from ansible.module_utils.network.common.cfg.base import ConfigBase
|
||||||
from ansible.module_utils.network.common.utils import to_list, get_xml_conf_arg
|
from ansible.module_utils.network.common.utils import to_list
|
||||||
from ansible.module_utils.network.junos.facts.facts import Facts
|
from ansible.module_utils.network.junos.facts.facts import Facts
|
||||||
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
from ansible.module_utils.network.junos.junos import locked_config, load_config, commit_configuration, discard_changes, tostring
|
||||||
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
from ansible.module_utils.network.common.netconf import build_root_xml_node, build_child_xml_node, build_subtree
|
||||||
|
|
|
@ -169,7 +169,7 @@ from ansible.module_utils.network.common.netconf import exec_rpc
|
||||||
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_configuration, get_connection, get_capabilities, tostring
|
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_configuration, get_connection, get_capabilities, tostring
|
||||||
from ansible.module_utils.network.common.parsing import Conditional, FailedConditionalError
|
from ansible.module_utils.network.common.parsing import Conditional, FailedConditionalError
|
||||||
from ansible.module_utils.network.common.utils import to_lines
|
from ansible.module_utils.network.common.utils import to_lines
|
||||||
from ansible.module_utils.six import string_types, iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -81,7 +81,6 @@ from ansible.module_utils._text import to_text
|
||||||
from ansible.module_utils.connection import ConnectionError
|
from ansible.module_utils.connection import ConnectionError
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_connection
|
from ansible.module_utils.network.junos.junos import junos_argument_spec, get_connection
|
||||||
from ansible.module_utils.network.junos.junos import commit_configuration, discard_changes
|
|
||||||
from ansible.module_utils.network.common.utils import to_list
|
from ansible.module_utils.network.common.utils import to_list
|
||||||
from ansible.module_utils.six import iteritems
|
from ansible.module_utils.six import iteritems
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ def main():
|
||||||
device = connect(module)
|
device = connect(module)
|
||||||
|
|
||||||
if not module.params['force']:
|
if not module.params['force']:
|
||||||
facts = device.facts_refresh()
|
device.facts_refresh()
|
||||||
has_ver = device.facts.get('version')
|
has_ver = device.facts.get('version')
|
||||||
wants_ver = module.params['version']
|
wants_ver = module.params['version']
|
||||||
do_upgrade = has_ver != wants_ver
|
do_upgrade = has_ver != wants_ver
|
||||||
|
|
|
@ -38,9 +38,6 @@ class TestJunosCommandModule(TestJunosModule):
|
||||||
self.mock_unlock_configuration = patch('ansible.module_utils.network.junos.junos.unlock_configuration')
|
self.mock_unlock_configuration = patch('ansible.module_utils.network.junos.junos.unlock_configuration')
|
||||||
self.unlock_configuration = self.mock_unlock_configuration.start()
|
self.unlock_configuration = self.mock_unlock_configuration.start()
|
||||||
|
|
||||||
self.mock_commit_configuration = patch('ansible.modules.network.junos.junos_netconf.commit_configuration')
|
|
||||||
self.commit_configuration = self.mock_commit_configuration.start()
|
|
||||||
|
|
||||||
self.mock_conn = patch('ansible.module_utils.connection.Connection')
|
self.mock_conn = patch('ansible.module_utils.connection.Connection')
|
||||||
self.conn = self.mock_conn.start()
|
self.conn = self.mock_conn.start()
|
||||||
|
|
||||||
|
@ -58,7 +55,6 @@ class TestJunosCommandModule(TestJunosModule):
|
||||||
super(TestJunosCommandModule, self).tearDown()
|
super(TestJunosCommandModule, self).tearDown()
|
||||||
self.mock_lock_configuration.stop()
|
self.mock_lock_configuration.stop()
|
||||||
self.mock_unlock_configuration.stop()
|
self.mock_unlock_configuration.stop()
|
||||||
self.mock_commit_configuration.stop()
|
|
||||||
self.mock_conn.stop()
|
self.mock_conn.stop()
|
||||||
self.mock_netconf.stop()
|
self.mock_netconf.stop()
|
||||||
self.mock_netconf_rpc.stop()
|
self.mock_netconf_rpc.stop()
|
||||||
|
|
Loading…
Reference in a new issue