1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-19 04:59:10 +03:00

s4-samba-tool: fixed exception handling in subcommands

this switches to the new pattern of:

 except Exception, e:
 	raise CommandError("some error message", e)
This commit is contained in:
Andrew Tridgell
2010-11-29 14:15:57 +11:00
parent 6250690310
commit 37bfc4ec38
13 changed files with 68 additions and 74 deletions

View File

@ -169,7 +169,7 @@ pwdLastSet: 0
raise Exception('Unable to find group "%s"' % groupname)
assert(len(targetgroup) == 1)
self.delete(targetgroup[0].dn)
except:
except Exception:
self.transaction_cancel()
raise
else:
@ -225,7 +225,7 @@ member: %s
if modified is True:
self.modify_ldif(addtargettogroup)
except:
except Exception:
self.transaction_cancel()
raise
else:
@ -351,7 +351,7 @@ member: %s
if setpassword:
self.setpassword("(samAccountName=%s)" % username, password,
force_password_change_at_next_login_req)
except:
except Exception:
self.transaction_cancel()
raise
else:
@ -389,7 +389,7 @@ unicodePwd:: %s
# modify the userAccountControl to remove the disabled bit
self.enable_account(search_filter)
except:
except Exception:
self.transaction_cancel()
raise
else:
@ -430,7 +430,7 @@ accountExpires: %u
""" % (user_dn, userAccountControl, accountExpires)
self.modify_ldif(setexp)
except:
except Exception:
self.transaction_cancel()
raise
else: