parent
5aa83041bf
commit
060ed665f6
1 changed files with 7 additions and 5 deletions
|
@ -21,7 +21,7 @@ import re
|
|||
import time
|
||||
import collections
|
||||
|
||||
from ansible.module_utils.basic import json
|
||||
from ansible.module_utils.basic import json, json_dict_bytes_to_unicode
|
||||
from ansible.module_utils.network import ModuleStub, NetworkError, NetworkModule
|
||||
from ansible.module_utils.network import add_argument, register_transport, to_list
|
||||
from ansible.module_utils.shell import CliBase
|
||||
|
@ -145,14 +145,14 @@ class Nxapi(NxapiConfigMixin):
|
|||
while commands:
|
||||
stack.append(commands.popleft())
|
||||
if len(stack) == 10:
|
||||
data = self._get_body(stack, output)
|
||||
data = self._jsonify(data)
|
||||
body = self._get_body(stack, output)
|
||||
data = self._jsonify(body)
|
||||
requests.append(data)
|
||||
stack = list()
|
||||
|
||||
if stack:
|
||||
data = self._get_body(stack, output)
|
||||
data = self._jsonify(data)
|
||||
body = self._get_body(stack, output)
|
||||
data = self._jsonify(body)
|
||||
requests.append(data)
|
||||
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
|
@ -279,12 +279,14 @@ class Cli(NxapiConfigMixin, CliBase):
|
|||
|
||||
Cli = register_transport('cli', default=True)(Cli)
|
||||
|
||||
|
||||
def prepare_config(commands):
|
||||
prepared = ['config']
|
||||
prepared.extend(to_list(commands))
|
||||
prepared.append('end')
|
||||
return prepared
|
||||
|
||||
|
||||
def prepare_commands(commands):
|
||||
jsonify = lambda x: '%s | json' % x
|
||||
for cmd in to_list(commands):
|
||||
|
|
Loading…
Reference in a new issue