From 90cff02b26fe5c81625fc5bede35ea93352b7de0 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Mon, 24 Jul 2023 15:44:27 -0700 Subject: [PATCH] Updated `gam print|show vaultexports|vaultholds|vaultqueries` to handle the case where a vault matter changes state from `OPEN` to `CLOSED|DELETED` while the command is being processed. --- src/GamUpdate.txt | 5 +++++ src/gam/__init__.py | 27 +++++++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 2f237c6f..e5924129 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,11 @@ Merged GAM-Team version +6.61.12 + +Updated `gam print|show vaultexports|vaultholds|vaultqueries` to handle the case +where a vault matter changes state from `OPEN` to `CLOSED|DELETED` while the command is being processed. + 6.61.11 Added option `returnidonly` to `gam create vaultexport|vaulthold|vaultmatter` diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 1263314d..4711212c 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -36752,10 +36752,17 @@ def getMatterItem(v, state=None): matterId, _, matterNameId, _ = convertMatterNameToID(v, getString(Cmd.OB_MATTER_ITEM), state=state) return (matterId, matterNameId) -def warnMatterNotOpen(matter, matterNameId, j, jcount): +def warnMatterNotOpen(v, matter, matterNameId, j, jcount): + if v is not None: + try: + matter['state'] = callGAPI(v.matters(), 'get', + throwReasons=[GAPI.NOT_FOUND, GAPI.FORBIDDEN], + matterId=matter['matterId'], view='BASIC', fields='state')['state'] + except (GAPI.notFound, GAPI.forbidden): + matter['state'] = 'Unknown' printWarningMessage(DATA_NOT_AVALIABLE_RC, formatKeyValueList('', Ent.FormatEntityValueList([Ent.VAULT_MATTER, matterNameId])+ - [Msg.MATTER_NOT_OPEN.format(matter.get('state', 'Unknown'))], + [Msg.MATTER_NOT_OPEN.format(matter['state'])], currentCount(j, jcount))) def _cleanVaultExport(export, cd): @@ -37136,13 +37143,13 @@ def doPrintShowVaultExports(): throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN], matterId=matterId, fields=fields) except GAPI.failedPrecondition: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(v, matter, matterNameId, j, jcount) continue except GAPI.forbidden as e: entityActionFailedWarning([Ent.VAULT_EXPORT, None], str(e)) break else: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(None, matter, matterNameId, j, jcount) continue kcount = len(exports) if not csvPF: @@ -37795,13 +37802,13 @@ def doPrintShowVaultHolds(): throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN], matterId=matterId, fields=fields) except GAPI.failedPrecondition: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(v, matter, matterNameId, j, jcount) continue except GAPI.forbidden as e: entityActionFailedWarning([Ent.VAULT_HOLD, None], str(e)) break else: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(None, matter, matterNameId, j, jcount) continue kcount = len(holds) if not csvPF: @@ -37845,7 +37852,7 @@ def printShowUserVaultHolds(entityList): matters = callGAPIpages(v.matters(), 'list', 'matters', pageMessage=getPageMessage(), throwReasons=[GAPI.FORBIDDEN], - view='BASIC', state='OPEN', fields='matters(matterId,name),nextPageToken') + view='BASIC', state='OPEN', fields='matters(matterId,name,state),nextPageToken') except GAPI.forbidden as e: entityActionFailedWarning([Ent.VAULT_HOLD, None], str(e)) return @@ -37863,7 +37870,7 @@ def printShowUserVaultHolds(entityList): throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN], matterId=matterId, fields='holds(holdId,name,accounts(accountId,email),orgUnit(orgUnitId)),nextPageToken') except GAPI.failedPrecondition: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(v, matter, matterNameId, j, jcount) except GAPI.forbidden as e: entityActionFailedWarning([Ent.VAULT_HOLD, None], str(e), j, jcount) totalHolds = 0 @@ -38052,13 +38059,13 @@ def doPrintShowVaultQueries(): throwReasons=[GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN], matterId=matterId, fields=fields) except GAPI.failedPrecondition: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(v, matter, matterNameId, j, jcount) continue except GAPI.forbidden as e: entityActionFailedWarning([Ent.VAULT_QUERY, None], str(e)) break else: - warnMatterNotOpen(matter, matterNameId, j, jcount) + warnMatterNotOpen(None, matter, matterNameId, j, jcount) continue kcount = len(queries) if not csvPF: