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