예제 #1
0
파일: restart.py 프로젝트: pankajb64/komey
def stop_service_local(action_args, user_args):
    modules = user_args["modules"].strip().split(",")
    nick = get_from_cache('terminal')
    password = get_from_cache(nick + '_sudo_password')
    for module in modules:
        command_args = {"mod_password": password, "module": module.strip()}
        user_args["command_args"] = json.dumps(command_args)
        user_args["command_file"] = "base/stop_base"
        exec_command(action_args, user_args)
예제 #2
0
파일: ssh.py 프로젝트: pankajb64/komey
def ssh_logout_all(action_args, user_args):
    terminals = get_from_cache('terminals', [])
    print "Closing these terminals %s" % terminals
    for my_nick in list(terminals):
        #print "Closing %s" %my_nick
        new_dict = {'nick': my_nick}
        ssh_logout(action_args, new_dict)
예제 #3
0
파일: ssh.py 프로젝트: pankajb64/komey
def ssh_logout(action_args, user_args):
    nick = user_args.get('nick')
    #print "Got Nick %s" %nick
    if nick is None:
        nick = get_from_cache('terminal')
    terminal = get_from_cache(nick.strip())
    if terminal is not None:
        #from komey.util.bcolors import bcolors
        #print "Logging out from %s" % nick
        terminal.logout()
        put_in_cache('terminal', None)
    else:
        #from komey.util.bcolors import bcolors
        print "%sWARNING - No such terminal %s%s" % (bcolors.WARNING, nick,
                                                     bcolors.ENDC)
    if nick is not None:
        remove_terminal_from_list(nick)
        remove_from_cache(nick)
예제 #4
0
def set_exit_command(action_args, user_args):
    files = get_from_cache('files', [])
    input_file = files[-1]
    put_in_cache(
        input_file + '_exit_command',
        os.getcwd() + '/commands/' + user_args['exit_command'].strip())