From 194b93a7ee5cbb6de72b1a61cb1938217c78f04e Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Tue, 7 Nov 2023 19:17:00 -0800 Subject: [PATCH] Updated `gam delete building` to handle the following error: ERROR: 412: conditionNotMet - Cannot delete building because there are Calendar resources associated with it. --- docs/GamUpdates.md | 7 +++++++ docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Resources.md | 6 +++--- ...AMADV-XTD3-securely-on-a-Google-Compute-Engine.md | 2 +- docs/Version-and-Help.md | 12 ++++++------ src/GamUpdate.txt | 7 +++++++ src/gam/__init__.py | 9 ++++++--- 7 files changed, 32 insertions(+), 15 deletions(-) diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 90b24da4..dc16294e 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -12,6 +12,13 @@ See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Win Updated `gam import|insert message` to allow `replace ` as documented. +### 6.65.07 + +Updated `gam delete building` to handle the following error: +``` +ERROR: 412: conditionNotMet - Cannot delete building because there are Calendar resources associated with it. +``` + ### 6.65.06 Improved error message when trying to add external students/teachers to a course. diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index c91971d3..b45c7986 100644 --- a/docs/How-to-Upgrade-from-Standard-GAM.md +++ b/docs/How-to-Upgrade-from-Standard-GAM.md @@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt. admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found -GAMADV-XTD3 6.65.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.10.8 64-bit final MacOS High Sierra 10.13.6 x86_64 @@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt. C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt C:\GAMADV-XTD3>gam version WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found -GAMADV-XTD3 6.65.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final Windows-10-10.0.17134 AMD64 diff --git a/docs/Resources.md b/docs/Resources.md index 20b98bc5..d9366ebe 100644 --- a/docs/Resources.md +++ b/docs/Resources.md @@ -165,7 +165,7 @@ The `quotechar ` option allows you to choose an alternate quote chara ## Manage features ``` -gam create|add feature +gam create|add feature name gam update feature name gam delete feature ``` @@ -194,10 +194,10 @@ When updating a resource, use the following options to manage the features. ## Display resources ``` gam info resource - [acls]Documents/GoogleApps/GAM3/Docs/ [calendar] + [acls] [noselfowner] [calendar] [formatjson] gam info resources - [acls]Documents/GoogleApps/GAM3/Docs/ [calendar] + [acls] [noselfowner] [calendar] [formatjson] gam show resources [allfields|*|(fields )] diff --git a/docs/Running-GAMADV-XTD3-securely-on-a-Google-Compute-Engine.md b/docs/Running-GAMADV-XTD3-securely-on-a-Google-Compute-Engine.md index 5a5ce49d..9da822c1 100644 --- a/docs/Running-GAMADV-XTD3-securely-on-a-Google-Compute-Engine.md +++ b/docs/Running-GAMADV-XTD3-securely-on-a-Google-Compute-Engine.md @@ -25,7 +25,7 @@ GAMADV-XTD3 version 6.50.00 or higher is required. * click on the Permissions tab. * click "Grant Access". * In the "New principals text box, paste the service account email you copied. - * Give your service account the "Service Account Token Creator" and "View Service Accounts" roles. + * Give your service account the "Service Account Key Admin", "Service Account Token Creator" and "View Service Accounts" roles. 4. [Create a Windows or Linux virtual machine](https://cloud.google.com/compute/docs/instances/create-start-instance). * You can choose a region physically close to you though you may be limited in your choices if you want to use the free tier. diff --git a/docs/Version-and-Help.md b/docs/Version-and-Help.md index 3bf6f8d2..51922a91 100644 --- a/docs/Version-and-Help.md +++ b/docs/Version-and-Help.md @@ -4,7 +4,7 @@ Print the current version of Gam with details ``` gam version -GAMADV-XTD3 6.65.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 @@ -16,7 +16,7 @@ Time: 2023-06-02T21:10:00-07:00 Print the current version of Gam with details and time offset information ``` gam version timeoffset -GAMADV-XTD3 6.65.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 @@ -28,7 +28,7 @@ Your system time differs from www.googleapis.com by less than 1 second Print the current version of Gam with extended details and SSL information ``` gam version extended -GAMADV-XTD3 6.65.06 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.07 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 @@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64 Path: /Users/Admin/bin/gamadv-xtd3 Version Check: Current: 5.35.08 - Latest: 6.65.06 + Latest: 6.65.07 echo $? 1 ``` @@ -73,7 +73,7 @@ echo $? Print the current version number without details ``` gam version simple -6.65.06 +6.65.07 ``` In Linux/MacOS you can do: ``` @@ -83,7 +83,7 @@ echo $VER Print the current version of Gam and address of this Wiki ``` gam help -GAM 6.65.06 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.65.07 - https://github.com/taers232c/GAMADV-XTD3 Ross Scroggs Python 3.12.0 64-bit final MacOS Monterey 12.7 x86_64 diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index b4e424d7..cd7644c1 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,6 +2,13 @@ Merged GAM-Team version +6.65.07 + +Updated `gam delete building` to handle the following error: +``` +ERROR: 412: conditionNotMet - Cannot delete building because there are Calendar resources associated with it. +``` + 6.65.06 Improved error message when trying to add external students/teachers to a course. diff --git a/src/gam/__init__.py b/src/gam/__init__.py index 496bb1aa..9166f351 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -34258,11 +34258,14 @@ def doDeleteBuilding(): checkForExtraneousArguments() try: callGAPI(cd.resources().buildings(), 'delete', - throwReasons=[GAPI.RESOURCE_NOT_FOUND, GAPI.BAD_REQUEST, GAPI.NOT_FOUND, GAPI.FORBIDDEN], + throwReasons=[GAPI.RESOURCE_NOT_FOUND, GAPI.CONDITION_NOT_MET, + GAPI.BAD_REQUEST, GAPI.NOT_FOUND, GAPI.FORBIDDEN], customer=GC.Values[GC.CUSTOMER_ID], buildingId=buildingId) entityActionPerformed([Ent.BUILDING_ID, buildingId]) except GAPI.resourceNotFound: entityUnknownWarning(Ent.BUILDING_ID, buildingId) + except GAPI.conditionNotMet as e: + entityActionFailedWarning([Ent.BUILDING_ID, buildingId], str(e)) except (GAPI.badRequest, GAPI.notFound, GAPI.forbidden): accessErrorExit(cd) @@ -34408,7 +34411,7 @@ def _getFeatureAttributes(body): unknownArgumentExit() return body -# gam create feature +# gam create feature name def doCreateFeature(): cd = buildGAPIObject(API.DIRECTORY) body = _getFeatureAttributes({}) @@ -34448,7 +34451,7 @@ def doUpdateFeature(): except (GAPI.badRequest, GAPI.notFound, GAPI.forbidden): accessErrorExit(cd) -# gam delete feature +# gam delete feature def doDeleteFeature(): cd = buildGAPIObject(API.DIRECTORY) featureKey = getString(Cmd.OB_NAME)