From 287fc411102293558ab25fc4e01d4210333babf7 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sat, 16 Oct 2010 16:46:48 +0200 Subject: [PATCH] Corretta gestione del proxy apt. --- 99_poisson_vpn.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 :) -- 2.1.4