python: Fix exception handler compatibility.
[cascardo/ovs.git] / debian / ovs-monitor-ipsec
index 414d18b..efab91b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#! /usr/bin/env python
 # Copyright (c) 2009, 2010, 2011, 2012 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,6 @@ import sys
 
 import ovs.dirs
 from ovs.db import error
-from ovs.db import types
 import ovs.util
 import ovs.daemon
 import ovs.db.idl
@@ -210,9 +209,9 @@ path certificate "%s";
         if host in self.psk_hosts:
             raise error.Error("host %s already defined for psk" % host)
 
-        if vals["certificate"] == None:
+        if vals["certificate"] is None:
             raise error.Error("'certificate' not defined for %s" % host)
-        elif vals["private_key"] == None:
+        elif vals["private_key"] is None:
             # Assume the private key is stored in the same PEM file as
             # the certificate.  We make a copy of "vals" so that we don't
             # modify the original "vals", which would cause the script
@@ -372,7 +371,7 @@ def update_ipsec(ipsec, interfaces, new_interfaces):
 
         try:
             ipsec.add_entry(vals["local_ip"], vals["remote_ip"], vals)
-        except error.Error, msg:
+        except error.Error as msg:
             vlog.warn("skipping ipsec config for %s: %s" % (name, msg))
 
 
@@ -441,7 +440,7 @@ def main():
 
         new_interfaces = {}
         for rec in idl.tables["Interface"].rows.itervalues():
-            if rec.type == "ipsec_gre" or rec.type == "ipsec_gre64":
+            if rec.type == "ipsec_gre":
                 name = rec.name
                 options = rec.options
                 peer_cert_name = "ovs-%s.pem" % (options.get("remote_ip"))