diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-11-29 14:15:57 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-11-29 18:04:42 +1100 |
commit | 37bfc4ec384df71a4cb1c19ceb136fecd3b9afc6 (patch) | |
tree | e44efedee115beac377d1fc9ab3a22c5e6cc2cee /source4/scripting/python/samba/netcmd/drs.py | |
parent | 62506903101e8e8e1cfc6c70fee245f97c646844 (diff) | |
download | samba-37bfc4ec384df71a4cb1c19ceb136fecd3b9afc6.tar.gz samba-37bfc4ec384df71a4cb1c19ceb136fecd3b9afc6.tar.bz2 samba-37bfc4ec384df71a4cb1c19ceb136fecd3b9afc6.zip |
s4-samba-tool: fixed exception handling in subcommands
this switches to the new pattern of:
except Exception, e:
raise CommandError("some error message", e)
Diffstat (limited to 'source4/scripting/python/samba/netcmd/drs.py')
-rw-r--r-- | source4/scripting/python/samba/netcmd/drs.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py index 387524b943..6f5b5b8ed3 100644 --- a/source4/scripting/python/samba/netcmd/drs.py +++ b/source4/scripting/python/samba/netcmd/drs.py @@ -44,8 +44,8 @@ def drsuapi_connect(ctx): try: ctx.drsuapi = drsuapi.drsuapi(binding_string, ctx.lp, ctx.creds) (ctx.drsuapi_handle, ctx.bind_supported_extensions) = drs_utils.drs_DsBind(ctx.drsuapi) - except Exception, estr: - raise CommandError("DRS connection to %s failed - %s" % (ctx.server, estr)) + except Exception, e: + raise CommandError("DRS connection to %s failed" % ctx.server, e) def samdb_connect(ctx): @@ -54,8 +54,8 @@ def samdb_connect(ctx): ctx.samdb = SamDB(url="ldap://%s" % ctx.server, session_info=system_session(), credentials=ctx.creds, lp=ctx.lp) - except Exception, estr: - raise CommandError("LDAP connection to %s failed - %s" % (ctx.server, estr)) + except Exception, e: + raise CommandError("LDAP connection to %s failed" % ctx.server, e) def drs_errmsg(werr): @@ -119,8 +119,8 @@ class cmd_drs_showrepl(Command): req1.info_type = info_type try: (info_type, info) = ctx.drsuapi.DsReplicaGetInfo(ctx.drsuapi_handle, 1, req1) - except Exception, estr: - raise CommandError("DsReplicaGetInfo failed : %s" % estr) + except Exception, e: + raise CommandError("DsReplicaGetInfo of type %u failed" % info_type, e) return (info_type, info) @@ -221,8 +221,8 @@ class cmd_drs_kcc(Command): req1 = drsuapi.DsExecuteKCC1() try: self.drsuapi.DsExecuteKCC(self.drsuapi_handle, 1, req1) - except Exception, (ecode, estr): - raise CommandError("DsExecuteKCC failed - %s" % estr) + except Exception, e: + raise CommandError("DsExecuteKCC failed", e) print("Consistency check on %s successful." % DC) @@ -289,8 +289,8 @@ class cmd_drs_replicate(Command): try: self.drsuapi.DsReplicaSync(self.drsuapi_handle, 1, req1) - except Exception, (ecode, estr): - raise CommandError("DsReplicaSync failed - %s" % estr) + except Exception, e: + raise CommandError("DsReplicaSync failed", estr) print("Replicate from %s to %s was successful." % (SOURCE_DC, DEST_DC)) |