summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Sprygada <psprygada@ansible.com>2016-08-31 07:24:07 -0400
committerPeter Sprygada <psprygada@ansible.com>2016-08-31 07:27:39 -0400
commit7fc46e8233fb707b8fe3b1a8220f9e3260c48d10 (patch)
tree8b58d336a4f0f288251f79b3638105eb5d87960a
parent1c33b5a9f041e0fdc4ef0973c7143c59c67bfeb9 (diff)
downloadansible-7fc46e8233fb707b8fe3b1a8220f9e3260c48d10.tar.gz
fixes authorize method in ios shared module
The authorize method was calling run_commands() instead of execute(). This fixes that problem so that authorize() calls are made direclty on the shell object now
-rw-r--r--lib/ansible/module_utils/ios.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/ansible/module_utils/ios.py b/lib/ansible/module_utils/ios.py
index d398dc52f1..38ba1dab01 100644
--- a/lib/ansible/module_utils/ios.py
+++ b/lib/ansible/module_utils/ios.py
@@ -18,13 +18,14 @@
#
import re
+import urlparse
from ansible.module_utils.basic import json
from ansible.module_utils.network import NetworkModule, NetworkError, ModuleStub
from ansible.module_utils.network import add_argument, register_transport, to_list
from ansible.module_utils.shell import CliBase
from ansible.module_utils.netcli import Command
-from ansible.module_utils.urls import fetch_url, url_argument_spec, urlparse
+from ansible.module_utils.urls import fetch_url, url_argument_spec
add_argument('use_ssl', dict(default=True, type='bool'))
add_argument('validate_certs', dict(default=True, type='bool'))
@@ -56,18 +57,17 @@ class Cli(CliBase):
def authorize(self, params, **kwargs):
passwd = params['auth_pass']
- self.run_commands(
- Command('enable', prompt=self.NET_PASSWD_RE, response=passwd)
- )
+ cmd = Command('enable', prompt=self.NET_PASSWD_RE, response=passwd)
+ self.execute([cmd])
### implementation of netcli.Cli ###
- def run_commands(self, commands, **kwargs):
+ def run_commands(self, commands):
return self.execute(to_list(commands))
### implementation of netcfg.Config ###
- def configure(self, commands, **kwargs):
+ def configure(self, commands):
cmds = ['configure terminal']
cmds.extend(to_list(commands))
if cmds[-1] != 'end':
@@ -183,7 +183,8 @@ class Restconf(object):
def run_commands(self, commands):
responses = list()
- for cmd in to_list(commands):
+ commands = [str(c) for c in commands]
+ for cmd in commands:
if str(cmd).startswith('show '):
cmd = str(cmd)[4:]
responses.append(self.execute(str(cmd)))