This patch fixes a bug in module_utils/ios.py where the the wrong shared
module arguments are being generated. This bug prevented the shared module
from operating correctly. This patch should be generally applied.
... | ... |
@@ -80,7 +80,7 @@ def ios_module(**kwargs): |
80 | 80 |
""" |
81 | 81 |
spec = kwargs.get('argument_spec') or dict() |
82 | 82 |
|
83 |
- argument_spec = url_argument_spec() |
|
83 |
+ argument_spec = shell_argument_spec() |
|
84 | 84 |
argument_spec.update(IOS_COMMON_ARGS) |
85 | 85 |
if kwargs.get('argument_spec'): |
86 | 86 |
argument_spec.update(kwargs['argument_spec']) |
... | ... |
@@ -150,21 +150,6 @@ class IosShell(object): |
150 | 150 |
responses.append(response) |
151 | 151 |
return responses |
152 | 152 |
|
153 |
-def ios_from_args(module): |
|
154 |
- """Extracts the set of argumetns to build a valid IOS connection |
|
155 |
- """ |
|
156 |
- params = dict() |
|
157 |
- for arg, attrs in IOS_COMMON_ARGS.iteritems(): |
|
158 |
- if module.params['device']: |
|
159 |
- params[arg] = module.params['device'].get(arg) |
|
160 |
- if arg not in params or module.params[arg]: |
|
161 |
- params[arg] = module.params[arg] |
|
162 |
- if params[arg] is None: |
|
163 |
- if attrs.get('required'): |
|
164 |
- module.fail_json(msg='argument %s is required' % arg) |
|
165 |
- params[arg] = attrs.get('default') |
|
166 |
- return params |
|
167 |
- |
|
168 | 153 |
def ios_connection(module): |
169 | 154 |
"""Creates a connection to an IOS device based on the module arguments |
170 | 155 |
""" |
... | ... |
@@ -180,16 +165,16 @@ def ios_connection(module): |
180 | 180 |
shell = IosShell() |
181 | 181 |
shell.connect(host, port=port, username=username, password=password, |
182 | 182 |
timeout=timeout) |
183 |
+ shell.send('terminal length 0') |
|
183 | 184 |
except paramiko.ssh_exception.AuthenticationException, exc: |
184 | 185 |
module.fail_json(msg=exc.message) |
185 | 186 |
except socket.error, exc: |
186 | 187 |
module.fail_json(msg=exc.strerror, errno=exc.errno) |
187 | 188 |
|
188 |
- shell.send('terminal length 0') |
|
189 |
- |
|
190 | 189 |
if module.params['enable_mode']: |
191 | 190 |
shell.authorize(module.params['enable_password']) |
192 | 191 |
|
193 | 192 |
return shell |
194 | 193 |
|
195 | 194 |
|
195 |
+ |