def start_vpn():
    try:
        check_output(["sudo", "ipsec", "start"])
    except CalledProcessError:
        return False
    else:
        time.sleep(10)

    if vpn_status() and add_route():
        time.sleep(3)
        turn_on_led_green()
        return True
    else:
        return False
Example #2
0
def start_vpn():
    try:
        check_output(["sudo", "ipsec", "start"])
        returncode = 0
        time.sleep(10)
    except CalledProcessError as e:
        returncode = e.returncode

    if returncode == 0 and vpn_status() and add_route():
        time.sleep(3)
        turn_on_led_green()
        return True
    else:
        return False
Example #3
0
def restart_vpn():
    turn_off_led_green()

    try:
        check_output(["sudo", "ipsec", "restart"])
    except CalledProcessError:
        return False
    else:
        time.sleep(10)

    if vpn_status() and add_route():
        time.sleep(3)
        turn_on_led_green()
        return True
    else:
        return False
def start_vpn():
    try:
        check_output(["sudo", "ipsec", "start"])
        returncode = 0
        time.sleep(10)
    except CalledProcessError as e:
        returncode = e.returncode
        
    if(returncode == 0):
        if(vpn_status()):
            if(add_route):
                time.sleep(3)
                turn_on_led_green()
                return True

    else:
        return False
Example #5
0
def restart_vpn():
    turn_off_led_green()

    try:
        check_output(["sudo", "ipsec", "restart"])
        returncode = 0
        time.sleep(10)
    except CalledProcessError as e:
        returncode = e.returncode

    if (returncode == 0):
        if (vpn_status()):
            if (add_route()):
                time.sleep(3)
                turn_on_led_green()
                return True
    else:
        return False