Exemplo n.º 1
0
def ant_build(action_args, user_args):
    module_str = user_args['modules']
    modules = module_str.strip().split(",")
    for module in modules:
        command_args = {"module": module}
        user_args['command_args'] = json.dumps(command_args)
        user_args['command_file'] = "base/ant_build"
        exec_command(action_args, user_args)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
def take_backup_base(action_args, user_args):
    #print "yaha aya"
    modules = user_args.get('modules', '')
    modules = modules.strip().split(",") if modules is not None else [""]
    for module in modules:
        command_args = {"backup_module": module.strip()}
        user_args["command_args"] = json.dumps(command_args)
        user_args["command_file"] = "base/take_backup_base"
        exec_command(action_args, user_args)
Exemplo n.º 4
0
def restart_tomcat(action_args, user_args):
    hosts = user_args['hosts'].strip().split(",")
    cred = user_args['credentials'].strip()
    for host in hosts:
        command_args = {
            "restart_tomcat_host": host.strip(),
            "restart_tomcat_cred": cred
        }
        user_args["command_args"] = json.dumps(command_args)
        user_args["command_file"] = "base/restart_tomcat"
        exec_command(action_args, user_args)
Exemplo n.º 5
0
def scp(action_args, user_args):
	hosts = user_args['hosts'].strip().split(",")
	files = user_args['files'].strip()
	dest = user_args['dest_dir'].strip()
	credentials_file = user_args['credentials'].strip()
	credentials_file = os.getcwd() + '/data/credentials/' + credentials_file
	credentials = {}
	with open(credentials_file, 'rb') as f:
		credentials = json.load(f)
	for host in hosts:
		arg_dest = credentials['username'].strip()+'@'+host.strip()+':'+dest
		command_args = { 'scp_password' : credentials['password'].strip(), 'scp_files_cmd' : files, 'scp_dest' : arg_dest }
		user_args['command_args'] = json.dumps(command_args)
		user_args['command_file'] = "base/scp"
		exec_command(action_args, user_args)
Exemplo n.º 6
0
def take_backup(action_args, user_args):
    modules = user_args.get('modules')
    modules = modules.strip().split(",") if modules is not None else [""]
    hosts = user_args['hosts'].strip().split(",")
    cred = user_args['credentials'].strip()
    for host in hosts:
        for module in modules:
            command_args = {
                "backup_host": host.strip(),
                "backup_cred": cred,
                "backup_module": module.strip()
            }
            print command_args
            user_args["command_args"] = json.dumps(command_args)
            user_args["command_file"] = "base/take_backup"
            exec_command(action_args, user_args)
Exemplo n.º 7
0
def start_service(action_args, user_args):
    modules = user_args["modules"].strip().split(",")
    hosts = user_args["hosts"].strip().split(",")
    cred = user_args["credentials"].strip()
    for host in hosts:
        host = host.strip()
        user_args["host"] = host
        user_args["nick"] = "start_" + host
        credentials_file = os.getcwd(
        ) + '/data/credentials/' + user_args['credentials'].strip()
        credentials = {}
        with open(credentials_file) as f:
            credentials = json.load(f)
        ssh_login(action_args, user_args)
        for module in modules:
            command_args = {
                "mod_password": credentials["password"],
                "module": module
            }
            user_args["command_args"] = json.dumps(command_args)
            user_args["command_file"] = "base/start_base"
            exec_command(action_args, user_args)
        ssh_logout(action_args, user_args)
Exemplo n.º 8
0
def restart_tomcat_base(action_args, user_args):
    user_args["command_args"] = "{}"
    user_args["command_file"] = "base/restart_tomcat_base"
    exec_command(action_args, user_args)