def main(): parsed_yaml = read_yaml() connection_params = form_connection_params_from_yaml(parsed_yaml) for device_output in collect_outputs(connection_params, COMMANDS_LIST): #print(device_output) print( "Capturing output to a file named after device in your local directory" )
def main(): parsed_yaml = read_yaml() loop = asyncio.get_event_loop() tasks = [ loop.create_task(collect_outputs(device, COMMANDS_LIST)) for device in form_connection_params_from_yaml(parsed_yaml) ] loop.run_until_complete(asyncio.wait(tasks)) for task in tasks: print(task.result())
def main(): parsed_yaml = read_yaml() connection_params = form_connection_params_from_yaml(parsed_yaml) for device_output in collect_outputs(connection_params, COMMANDS_LIST): print(device_output)
def getdevicename(parsed_yaml): parsed_yaml = read_yaml() for site_dict in parsed_yaml["all"]["sites"]: for host in site_dict["hosts"]: device_name = host.get('hostname') yield device_name