def commander_ssh(device, command, output_list): hall_pass = threading.Lock() print("thread locked?: {}".format(hall_pass.locked())) with hall_pass: output_list.append({ 'name': device.get('host'), 'version_data': ssh_command2(device, command) }) time.sleep(1) print(len(output_list)) print("thread locked?: {}".format(hall_pass.locked()))
def wrapper(device): output = ssh_command2(device, 'show version') return output
def commander_ssh(device, command, output_list): output_list.append({ 'name': device.get('host'), 'version_data': ssh_command2(device, command) })
def commander_ssh(device, command, output_queue): output_queue.put({ 'name': device.get('host'), 'version_data': ssh_command2(device, command) })