diff options
author | Amitay Isaacs <amitay@gmail.com> | 2012-01-24 11:54:54 +1100 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2012-01-24 03:32:40 +0100 |
commit | 1f0298dd1b1a939cb215e7b474178b217f8347f4 (patch) | |
tree | 6ca7a3908b797f6e35b91c6156fb9d9a5bed4697 | |
parent | be292021f47eeaa1364bedb2dc9232b60c404fce (diff) | |
download | samba-1f0298dd1b1a939cb215e7b474178b217f8347f4.tar.gz samba-1f0298dd1b1a939cb215e7b474178b217f8347f4.tar.bz2 samba-1f0298dd1b1a939cb215e7b474178b217f8347f4.zip |
python: Change except: statement to except Exception:
This way we only catch true exceptions and keyboard interrupts
are not caught here.
Autobuild-User: Amitay Isaacs <amitay@samba.org>
Autobuild-Date: Tue Jan 24 03:32:40 CET 2012 on sn-devel-104
-rwxr-xr-x | source4/dsdb/tests/python/dirsync.py | 2 | ||||
-rwxr-xr-x | source4/scripting/bin/upgradeprovision | 8 | ||||
-rwxr-xr-x | source4/scripting/devel/repl_cleartext_pwd.py | 6 | ||||
-rw-r--r-- | source4/scripting/python/samba/join.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/dbcheck.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/netcmd/domain.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/provision/sambadns.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/dcerpc/testrpc.py | 2 | ||||
-rwxr-xr-x | source4/setup/provision | 2 |
9 files changed, 15 insertions, 15 deletions
diff --git a/source4/dsdb/tests/python/dirsync.py b/source4/dsdb/tests/python/dirsync.py index 6da9003bf5..64b847f430 100755 --- a/source4/dsdb/tests/python/dirsync.py +++ b/source4/dsdb/tests/python/dirsync.py @@ -136,7 +136,7 @@ class SimpleDirsyncTests(DirsyncBaseTests): self.sd_utils.modify_sd_on_dn(self.base_dn, self.desc_sddl) try: self.ldb_admin.deletegroup("testgroup") - except: + except Exception: pass #def test_dirsync_errors(self): diff --git a/source4/scripting/bin/upgradeprovision b/source4/scripting/bin/upgradeprovision index 738d6be891..aec0774a9d 100755 --- a/source4/scripting/bin/upgradeprovision +++ b/source4/scripting/bin/upgradeprovision @@ -1488,14 +1488,14 @@ def copyxattrs(dir, refdir): samba.xattr_native.wrap_setxattr(tgt, xattr.XATTR_NTACL_NAME, attribute) - except: + except Exception: noxattr = 1 attribute = samba.xattr_native.wrap_getxattr(ref, "system.posix_acl_access") samba.xattr_native.wrap_setxattr(tgt, "system.posix_acl_access", attribute) - except: + except Exception: continue for name in dirs: subdir=root[len(dir):] @@ -1511,7 +1511,7 @@ def copyxattrs(dir, refdir): samba.xattr_native.wrap_setxattr(tgt, xattr.XATTR_NTACL_NAME, attribute) - except: + except Exception: noxattr = 1 attribute = samba.xattr_native.wrap_getxattr(ref, "system.posix_acl_access") @@ -1519,7 +1519,7 @@ def copyxattrs(dir, refdir): "system.posix_acl_access", attribute) - except: + except Exception: continue diff --git a/source4/scripting/devel/repl_cleartext_pwd.py b/source4/scripting/devel/repl_cleartext_pwd.py index 840d281a6e..5eebc8689d 100755 --- a/source4/scripting/devel/repl_cleartext_pwd.py +++ b/source4/scripting/devel/repl_cleartext_pwd.py @@ -101,7 +101,7 @@ if __name__ == "__main__": if len(args) >= 7: try: attid = int(args[4], 16) - except: + except Exception: attid = int(args[4]) attname = args[5] attmode = args[6] @@ -145,7 +145,7 @@ if __name__ == "__main__": assert store_dn == dn #print "%s" % ndr_print(store_hwm) #print "%s" % ndr_print(store_utdv) - except: + except Exception: store_dn = dn store_hwm = drsuapi.DsReplicaHighWaterMark() store_hwm.tmp_highest_usn = 0 @@ -325,7 +325,7 @@ if __name__ == "__main__": cleartext_unicode = unicode(cleartext_utf16, 'utf-16-le') cleartext_utf8 = cleartext_unicode.encode('utf-8') gls.add_attr(obj.identifier.dn, clear_utf8_name, [cleartext_utf8]) - except: + except Exception: pass if attvals is not None: diff --git a/source4/scripting/python/samba/join.py b/source4/scripting/python/samba/join.py index 818e0cec6d..dc2ceef339 100644 --- a/source4/scripting/python/samba/join.py +++ b/source4/scripting/python/samba/join.py @@ -683,7 +683,7 @@ class dc_join(object): ctx.destination_dsa_guid = destination_dsa_guid print "Committing SAM database" - except: + except Exception: ctx.local_samdb.transaction_cancel() raise else: diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py index bd250eb6be..875b059506 100644 --- a/source4/scripting/python/samba/netcmd/dbcheck.py +++ b/source4/scripting/python/samba/netcmd/dbcheck.py @@ -112,7 +112,7 @@ class cmd_dbcheck(Command): else: error_count = chk.check_database(DN=DN, scope=search_scope, controls=controls, attrs=attrs) - except: + except Exception: if started_transaction: samdb.transaction_cancel() raise diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py index 6c2ebfa301..1e26850277 100644 --- a/source4/scripting/python/samba/netcmd/domain.py +++ b/source4/scripting/python/samba/netcmd/domain.py @@ -855,7 +855,7 @@ class cmd_domain_samba3upgrade(Command): samba.ntacls.setntacl(lp, tmpfile.name, "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native") eadb = False - except: + except Exception: # FIXME: Don't catch all exceptions here logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. " "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.") diff --git a/source4/scripting/python/samba/provision/sambadns.py b/source4/scripting/python/samba/provision/sambadns.py index db98f13ddd..4805294676 100644 --- a/source4/scripting/python/samba/provision/sambadns.py +++ b/source4/scripting/python/samba/provision/sambadns.py @@ -719,7 +719,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid): "DOMAINSID" : str(domainsid), "DESCRIPTOR" : descr}) setup_add_ldif(dom_ldb, setup_path("provision_basedn_options.ldif"), None) - except: + except Exception: logger.error("Failed to setup database for BIND, AD based DNS cannot be used") raise del partfile[domaindn] @@ -754,7 +754,7 @@ def create_samdb_copy(samdb, logger, paths, names, domainsid, domainguid): tdb_copy(logger, os.path.join(private_dir, pfile), os.path.join(dns_dir, pfile)) - except: + except Exception: logger.error("Failed to setup database for BIND, AD based DNS cannot be used") raise diff --git a/source4/scripting/python/samba/tests/dcerpc/testrpc.py b/source4/scripting/python/samba/tests/dcerpc/testrpc.py index 44fed72fff..9c2541934f 100644 --- a/source4/scripting/python/samba/tests/dcerpc/testrpc.py +++ b/source4/scripting/python/samba/tests/dcerpc/testrpc.py @@ -61,7 +61,7 @@ class RpcTests(object): print "ERROR: Failed to instantiate %s.%s" % (typename, n) self.errcount += 1 continue - except: + except Exception: print "ERROR: Failed to instantiate %s.%s" % (typename, n) self.errcount += 1 continue diff --git a/source4/setup/provision b/source4/setup/provision index cea8823d09..be528545fd 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -230,7 +230,7 @@ elif opts.use_xattrs == "auto" and not lp.get("posix:eadb"): samba.ntacls.setntacl(lp, file.name, "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native") eadb = False - except: + except Exception: logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. " "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.") file.close() |