예제 #1
0
def execute_command_with_progress(hostname,
                                  ssh_command,
                                  id_domain=None,
                                  user='******',
                                  port=22):
    # INFO TO DEVELOPER, QUIZÁS DEBERÍA ARRANCAR ESTA OPCIÓN EN OTRO THREAD, PARA NO COLAPSAR EL THREAD DE DISK OPERATIONS
    id = insert_disk_operation({'commands': [ssh_command]})
    before = time.time()
    progress = []
    array_out_err = exec_remote_updating_progress(ssh_command,
                                                  hostname,
                                                  progress,
                                                  username=user,
                                                  port=port,
                                                  id_domain=id_domain)
    after = time.time()
    time_elapsed = after - before
    update_disk_operation(
        id, {
            'time_elapsed': time_elapsed,
            'host': hostname,
            'commands': [ssh_command],
            'results': array_out_err
        })
    return array_out_err
예제 #2
0
def execute_commands(hostname,
                     ssh_commands,
                     dict_mode=False,
                     user='******',
                     port=22):
    id = insert_disk_operation({'commands': ssh_commands})
    before = time.time()
    dict_mode = True if type(ssh_commands[0]) is dict else False
    if dict_mode == True:
        array_out_err = exec_remote_list_of_cmds_dict(hostname,
                                                      ssh_commands,
                                                      username=user,
                                                      port=port)
    else:
        array_out_err = exec_remote_list_of_cmds(hostname,
                                                 ssh_commands,
                                                 username=user,
                                                 port=port)
    after = time.time()
    time_elapsed = after - before
    update_disk_operation(
        id, {
            'time_elapsed': time_elapsed,
            'host': hostname,
            'commands': ssh_commands,
            'results': array_out_err
        })
    return array_out_err
예제 #3
0
def execute_commands(hostname, ssh_commands, dict_mode=False, user='******', port=22):
    id = insert_disk_operation({'commands': ssh_commands})
    before = time.time()
    dict_mode = True if type(ssh_commands[0]) is dict else False
    if dict_mode == True:
        array_out_err = exec_remote_list_of_cmds_dict(hostname, ssh_commands, username=user, port=port)
    else:
        array_out_err = exec_remote_list_of_cmds(hostname, ssh_commands, username=user, port=port)
    after = time.time()
    time_elapsed = after - before
    update_disk_operation(id, {'time_elapsed': time_elapsed, 'host': hostname, 'commands': ssh_commands,
                               'results': array_out_err})
    return array_out_err
예제 #4
0
def execute_command_with_progress(hostname, ssh_command, id_domain=None, user='******', port=22):
    # INFO TO DEVELOPER, QUIZÁS DEBERÍA ARRANCAR ESTA OPCIÓN EN OTRO THREAD, PARA NO COLAPSAR EL THREAD DE DISK OPERATIONS
    id = insert_disk_operation({'commands': [ssh_command]})
    before = time.time()
    progress = []
    array_out_err = exec_remote_updating_progress(ssh_command,
                                                  hostname,
                                                  progress,
                                                  username=user,
                                                  port=port,
                                                  id_domain=id_domain)
    after = time.time()
    time_elapsed = after - before
    update_disk_operation(id, {'time_elapsed': time_elapsed, 'host': hostname, 'commands': [ssh_command],
                               'results': array_out_err})
    return array_out_err