Skip to content

Commit

Permalink
Updated gam <UserTypeEntity> archive messages <GroupItem>
Browse files Browse the repository at this point in the history
  • Loading branch information
taers232c committed Dec 17, 2024
1 parent 9244413 commit db9ab3e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/winget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: taers232c.GAMADV-XTD3
release-tag: v7.02.01
release-tag: v7.02.02
max-versions-to-keep: 1 # keep only latest versions
installers-regex: '\.msi$'
token: ${{ secrets.WINGET_TOKEN }}
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ script:

before_deploy:
# Comment out for Linux Xenial and Trusty
#- yes | gem update --system --force
#- gem install bundler
#- gem install faraday-net_http -v '3.3.0' # Fix faraday version
#- gem install uri
#- gem install logger
- yes | gem update --system --force
- gem install bundler
- gem install faraday-net_http -v '3.3.0' # Fix faraday version
- gem install uri
- gem install logger
- export TRAVIS_TAG="preview"
- unset LD_LIBRARY_PATH

Expand All @@ -115,8 +115,8 @@ deploy:
# Linux 64-Bit Bionic and Linux ARM64 Focal and Linux ARM64 Bionic and Linux ARM64 Xenial
# edge: true
# Linux Xenial and Trusty
edge:
branch: v2.0.3-beta.4
# edge:
# branch: v2.0.3-beta.4
# branch: v2.0.5-beta.1
on:
repo: taers232c/GAMADV-XTD3
Expand Down
6 changes: 6 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
7.02.02

Updated `gam <UserTypeEntity> archive messages <GroupItem>` to retry the following unexpected error
that occurs after many messages have been successfully archived.
`ERROR: 404: notFound - Unable to lookup group`

7.02.01

Added options `locked` and `unlocked` to `gam update cigroups` that allow locking/unlocking groups.
Expand Down
23 changes: 13 additions & 10 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"""

__author__ = 'Ross Scroggs <[email protected]>'
__version__ = '7.02.01'
__version__ = '7.02.02'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'

#pylint: disable=wrong-import-position
Expand Down Expand Up @@ -34857,7 +34857,7 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
entityActionFailedWarning([Ent.CLOUD_IDENTITY_GROUP, group], str(e), i, count)
continue
# If a group currently isn't a security group or locked, and we want to add security and locked,
# we have to do two commands to avoid a beta bug
# we have to do two commands to meet a beta requirement
ci_body.setdefault('labels', {})
if ((CIGROUP_SECURITY_LABEL not in cigInfo['labels']) and
(CIGROUP_LOCKED_LABEL not in cigInfo['labels']) and
Expand All @@ -34880,16 +34880,15 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
try:
if twoUpdates:
ci_body['labels'].pop(CIGROUP_LOCKED_LABEL)
callGAPI(cipl.groups(), 'patch',
throwReasons=GAPI.CIGROUP_UPDATE_THROW_REASONS,
retryReasons=GAPI.CIGROUP_RETRY_REASONS,
name=name, body=ci_body, updateMask=','.join(list(ci_body.keys())))
if twoUpdates:
ci_body['labels'][CIGROUP_LOCKED_LABEL] = ''
callGAPI(cipl.groups(), 'patch',
throwReasons=GAPI.CIGROUP_UPDATE_THROW_REASONS,
retryReasons=GAPI.CIGROUP_RETRY_REASONS,
name=name, body=ci_body, updateMask=','.join(list(ci_body.keys())))
ci_body['labels'][CIGROUP_LOCKED_LABEL] = ''
callGAPI(cipl.groups(), 'patch',
throwReasons=GAPI.CIGROUP_UPDATE_THROW_REASONS,
retryReasons=GAPI.CIGROUP_RETRY_REASONS,
name=name, body=ci_body, updateMask=','.join(list(ci_body.keys())))
except (GAPI.notFound, GAPI.groupNotFound, GAPI.domainNotFound, GAPI.domainCannotUseApis,
GAPI.forbidden, GAPI.badRequest, GAPI.invalid, GAPI.invalidInput, GAPI.invalidArgument,
GAPI.systemError, GAPI.permissionDenied, GAPI.failedPrecondition, GAPI.serviceNotAvailable) as e:
Expand Down Expand Up @@ -35152,7 +35151,7 @@ def _batchRemoveGroupMembers(group, i, count, removeMembers, role):
removeRoles = []
postUpdateRoles = []
memberRoles = callGAPI(ci.groups().memberships(), 'get',
name=memberName, fields=f'name,preferredMemberKey,roles,type')
name=memberName, fields='name,preferredMemberKey,roles,type')
getCIGroupMemberRoleFixType(memberRoles)
current_roles = [crole['name'] for crole in memberRoles['roles']]
# When upgrading role, strip any expiryDetail from member before role changes
Expand Down Expand Up @@ -69680,8 +69679,9 @@ def _processMessageFailed(user, idsList, errMsg, j=0, jcount=0):
stream.write(base64.urlsafe_b64decode(str(message['raw'])))
try:
callGAPI(gm.archive(), 'insert',
throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.BAD_REQUEST, GAPI.INVALID,
throwReasons=GAPI.GMAIL_THROW_REASONS+[GAPI.NOT_FOUND, GAPI.BAD_REQUEST, GAPI.INVALID,
GAPI.FAILED_PRECONDITION, GAPI.FORBIDDEN],
retryReasons=[GAPI.NOT_FOUND],
groupId=group, media_body=googleapiclient.http.MediaIoBaseUpload(stream, mimetype='message/rfc822', resumable=True))
if not csvPF:
entityActionPerformed([Ent.USER, user, entityType, messageId], j, jcount)
Expand All @@ -69690,6 +69690,9 @@ def _processMessageFailed(user, idsList, errMsg, j=0, jcount=0):
except GAPI.serviceNotAvailable:
userGmailServiceNotEnabledWarning(user, i, count)
break
except GAPI.notFound as e:
_processMessageFailed(user, messageId, str(e), j, jcount)
break
except (GAPI.badRequest, GAPI.invalid, GAPI.failedPrecondition, GAPI.forbidden,
googleapiclient.errors.MediaUploadSizeError) as e:
_processMessageFailed(user, messageId, str(e), j, jcount)
Expand Down

0 comments on commit db9ab3e

Please sign in to comment.