def stop_vpn(): try: check_output(["sudo", "ipsec", "stop"]) except CalledProcessError: return False else: turn_off_led_green() return True
def stop_vpn(): try: check_output(["sudo", "ipsec", "stop"]) except CalledProcessError: return False else: turn_off_led_green() return True
def stop_vpn(): try: check_output(["sudo", "ipsec", "stop"]) returncode = 0 turn_off_led_green() except CalledProcessError as e: returncode = e.returncode return returncode == 0
def stop_vpn(): try: check_output(["sudo", "ipsec", "stop"]) returncode = 0 turn_off_led_green() except CalledProcessError as e: returncode = e.returncode if(returncode == 0): return True else: return False
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 and vpn_status() and add_route(): time.sleep(3) turn_on_led_green() return True else: return False
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 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