Exemplo n.º 1
0
        if form.getvalue('view') is None:
            funct.get_button("Just save", value="save")
            funct.get_button("Upload and restart")
        print('</form></center>')

if form.getvalue('master'):
    master = form.getvalue('master')
    slave = form.getvalue('slave')
    interface = form.getvalue('interface')
    vrrpip = form.getvalue('vrrpip')
    hap = form.getvalue('hap')
    tmp_config_path = funct.get_config_var('haproxy', 'tmp_config_path')
    script = "install_keepalived.sh"

    if hap == "1":
        funct.install_haproxy(master)
        funct.install_haproxy(slave)

    os.system("cp scripts/%s ." % script)

    funct.upload(master, tmp_config_path, script)
    funct.upload(slave, tmp_config_path, script)

    commands = [
        "chmod +x " + tmp_config_path + script,
        tmp_config_path + script + " MASTER " + interface + " " + vrrpip
    ]
    funct.ssh_command(master, commands)

    commands = [
        "chmod +x " + tmp_config_path + script,
Exemplo n.º 2
0
    ssh_port = ''
    ssh_user_name = ''
    ssh_user_password = ''

    proxy_serv = proxy if proxy is not None else ""

    for sshs in sql.select_ssh(serv=master):
        ssh_enable = sshs[3]
        ssh_user_name = sshs[4]
        ssh_user_password = sshs[5]
        ssh_key_name = fullpath + '/keys/%s.pem' % sshs[2]

    os.system("cp scripts/%s ." % script)

    if form.getvalue('hap') == "1":
        funct.install_haproxy(master)
        funct.install_haproxy(slave)

    commands = [
        "chmod +x " + script + " &&  ./" + script + " PROXY=" + proxy_serv +
        " ETH=" + ETH + " IP=" + str(IP) + " MASTER=MASTER" + " SYN_FLOOD=" +
        syn_flood + " HOST=" + str(master) + " USER="******" PASS="******" KEY=" + str(ssh_key_name)
    ]

    output, error = funct.subprocess_execute(commands[0])

    if error:
        funct.logging('localhost', error, haproxywi=1)
        print('error: ' + error)
    else:
Exemplo n.º 3
0
		if i % 2 == 0: 
			print('<div class="line3">' + line + '</div>')
		else:
			print('<div class="line">' + line + '</div>')

if form.getvalue('master'):
	master = form.getvalue('master')
	slave = form.getvalue('slave')
	interface = form.getvalue('interface')
	vrrpip = form.getvalue('vrrpip')
	hap = form.getvalue('hap')
	tmp_config_path = config.get('haproxy', 'tmp_config_path')
	script = "install_keepalived.sh"
	
	if hap == "1":
		funct.install_haproxy(master)
		funct.install_haproxy(slave)
	
	os.system("cp scripts/%s ." % script)
		
	funct.upload(master, tmp_config_path, script)
	funct.upload(slave, tmp_config_path, script)
	
	commands = [ "chmod +x "+tmp_config_path+script, tmp_config_path+script+" MASTER "+interface+" "+vrrpip ]
	funct.ssh_command(master, commands)
	
	commands = [ "chmod +x "+tmp_config_path+script, tmp_config_path+script+" BACKUP "+interface+" "+vrrpip ]
	funct.ssh_command(slave, commands)
			
	os.system("rm -f %s" % script)
	sql.update_server_master(master, slave)