Symptom
Python script hangs and does not timeout
Conditions
The script hangs if the JSON template is used.
Workaround
Modified the script without Json template and the script ran without issues.
-----------------------------------------------------
Output when non-working script is used
------------------------------------------------------
switch# python bootflash:man.py
^CTraceback (most recent call last):
File "/bootflash/man.py", line 19, in
cisco.vrf.set_global_vrf('management')
File "/isan/python/scripts/cisco/vrf.py", line 19, in set_global_vrf
vrf = VRF.get_vrf_id_by_name(vrf)
File "/isan/python/scripts/cisco/vrf.py", line 61, in get_vrf_id_by_name
vrf_id = int(VRF._get_vrf_info(0, target_vrf_name, 1))
File "/isan/python/scripts/cisco/vrf.py", line 47, in _get_vrf_info
output = nxos_utils.cli_ex('show vrf')
File "/isan/python/scripts/nxos_utils.py", line 69, in cli_ex
return runVshCmd(cmd)
File "/isan/python/scripts/nxos_utils.py", line 65, in runVshCmd
output,error = subprocess.Popen(args,stdout = subprocess.PIPE, stderr= subprocess.PIPE).communicate()
File "/isan/python/python2.7/subprocess.py", line 806, in communicate
return self._communicate(input)
File "/isan/python/python2.7/subprocess.py", line 1382, in _communicate
stdout, stderr = self._communicate_with_poll(input)
File "/isan/python/python2.7/subprocess.py", line 1436, in _communicate_with_poll
ready = poller.poll()
----------------------------------------------
output when working script is used
-----------------------------------------------
switch# python bootflash:sa.py
------ run 0 -----
------ run 1 -----
------ run 2 -----
------ run 3 -----
------ run 4 -----
------ run 5 -----
------ run 6 -----
------ run 7 -----
------ run 8 -----
------ run 9 -----
switch#