Corretta gestione del proxy apt.
Leonardo Robol [2010-10-16 14:46]
Corretta gestione del proxy apt.
diff --git a/99_poisson_vpn.py b/99_poisson_vpn.py
index ef243a9..b332484 100755
--- a/99_poisson_vpn.py
+++ b/99_poisson_vpn.py
@@ -145,6 +145,7 @@ def get_base_connection():
# Se siamo arrivati a questo punto significa che la connessione attiva
# non è direttamente connessa a poisson.phc-priv e qunidi possiamo
# anche lasciar perdere
+ reset_apt_proxy ()
return None
def has_default_route():
@@ -235,8 +236,9 @@ def activate_connection(connection):
reset_apt_proxy ()
def reset_apt_proxy():
+ """Delete apt proxy configuration file"""
if os.path.exists(apt_proxy_file):
- os.path.remove(apt_proxy_file)
+ os.remove(apt_proxy_file)
def setup_apt_proxy():
if not os.path.exists(apt_proxy_file):
@@ -251,7 +253,6 @@ if __name__ == "__main__":
# che ti riattivi quella per poisson (anche perché potresti stare
# cercando di liberartente).
if sys.argv[2] == "vpn-down":
- delete_apt_proxy()
sys.exit (0)
# Se è appena stata attivata una VPN non ha senso cercare di
@@ -263,7 +264,7 @@ if __name__ == "__main__":
# Se hai appena deconfigurato un'interfaccia probabilmente non
# desideri attivare la VPN
if sys.argv[2] == "down":
- delete_apt_proxy()
+ reset_apt_proxy()
sys.exit (0)
# Otteniamo il bus
@@ -275,6 +276,7 @@ if __name__ == "__main__":
# Se non l'abbiamo trovata oppure è
# già attiva possiamo anche uscire
if (poisson_vpn is None):
+ reset_apt_proxy ()
sys.exit (0)
# Altrimenti la attiviamo, e poi usciamo :)