Skip to content

Commit 8ddc506

Browse files
author
rsmekala
committed
Refactored code to remove unused usages, and modified comments
1 parent dd656f9 commit 8ddc506

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

action_plugins/juniper_junos_common_action.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@
3636
from ansible.module_utils.basic import boolean as ansible_vars_convert_to_boolean
3737
import os
3838

39-
try:
40-
# Python 2
41-
basestring
42-
except NameError:
43-
# Python 3
44-
basestring = str
4539

4640
connection_spec_fallbacks = {
4741
'host': ['ansible_host', 'inventory_hostname'],
@@ -54,7 +48,7 @@
5448

5549
# Moved the defintion
5650
class ActionModule(ActionNetworkModule):
57-
"""A subclass of ActionNormal used by all juniper_junos_* modules.
51+
"""A subclass of ansible.plugins.action.network.ActionModule used by all juniper_junos_* modules.
5852
5953
All juniper_junos_* modules share common behavior which is implemented in
6054
this class. This includes specific option fallback/default behavior and
@@ -64,6 +58,8 @@ class ActionModule(ActionNetworkModule):
6458
convert_to_bool: Try converting to bool using aliases for bool.
6559
"""
6660
def run(self, tmp=None, task_vars=None):
61+
# This variable is no longer used in the run definition
62+
del tmp
6763
# The new connection arguments based on fallback/defaults.
6864
new_connection_args = dict()
6965

module_utils/juniper_junos_common.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -507,25 +507,14 @@ class ModuleDocFragment(object):
507507
required=False,
508508
default=30),
509509
}
510+
510511
# Connection arguments which are mutually exclusive.
511512
connection_spec_mutually_exclusive = [['mode', 'console'],
512513
['port', 'console'],
513514
['baud', 'console'],
514515
['attempts','console'],
515516
['cs_user', 'console'],
516517
['cs_passwd', 'console']]
517-
# Keys are connection options. Values are a list of task_vars to use as the
518-
# default value. Order of values specified against each key represents the
519-
# preference order of options in the key. Has to be maintained consistent with
520-
# ansible core modules
521-
connection_spec_fallbacks = {
522-
'host': ['ansible_host', 'inventory_hostname'],
523-
'user': ['ansible_connection_user', 'ansible_ssh_user', 'ansible_user'],
524-
'passwd': ['ansible_ssh_pass', 'ansible_pass'],
525-
'port': ['ansible_ssh_port', 'ansible_port'],
526-
'ssh_private_key_file': ['ansible_ssh_private_key_file',
527-
'ansible_private_key_file']
528-
}
529518

530519
# Specify the provider spec with options matching connection_spec.
531520
provider_spec = {
@@ -1888,5 +1877,3 @@ def save_text_output(self, name, format, text):
18881877
except IOError:
18891878
self.fail_json(msg="Unable to save output. Failed to "
18901879
"open the %s file." % (file_path))
1891-
1892-

0 commit comments

Comments
 (0)