From f0cddbe7c2bc6970eb9aa4f7482268bf5a253132 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Sat, 18 Nov 2023 08:49:28 -0800 Subject: [PATCH] Fixed bug in `gam print|show crostelemetry Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command is interrupted with a contol-C. It's a pyinstaller issue, revert to 5.13.2 for Mac OS --- .github/workflows/build.yml | 4 +++- docs/GamUpdates.md | 7 ++++++- docs/How-to-Upgrade-from-Standard-GAM.md | 4 ++-- docs/Version-and-Help.md | 12 ++++++------ src/GamUpdate.txt | 7 ++++++- src/gam/__init__.py | 18 +++++++++++++----- 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b4b1eb1..f71a56e6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,7 +114,7 @@ jobs: path: | bin.tar.xz src/cpython - key: gam-${{ matrix.jid }}-20231020 + key: gam-${{ matrix.jid }}-202311118 - name: Untar Cache archive if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true' @@ -489,6 +489,8 @@ jobs: git checkout "v5.13.2" elif [[ "${RUNNER_OS}" == "Windows" ]]; then git checkout "v5.13.2" + elif [[ "${RUNNER_OS}" == "macOS" ]]; then + git checkout "v5.13.2" else git checkout "${latest_release}" fi diff --git a/docs/GamUpdates.md b/docs/GamUpdates.md index 2ade8b3d..b6b49d9d 100644 --- a/docs/GamUpdates.md +++ b/docs/GamUpdates.md @@ -10,7 +10,7 @@ Add the `-s` option to the end of the above commands to suppress creating the `g See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation -### 6.65.10 +### 6.65.11 Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command is interrupted with a contol-C. @@ -18,6 +18,11 @@ is interrupted with a contol-C. multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be N leaked semaphore objects to clean up at shutdown ``` +Fixed bug in `gam print|show crostelemetry` where no CrOS device data was displayed if no selection +options were chosen; now, data is displayed for all CrOS devices as documented. + +### 6.65.10 + Fixed bug in `gam print crostelemetry` that caused a trap: `KeyError: 'reportTime'`. ### 6.65.09 diff --git a/docs/How-to-Upgrade-from-Standard-GAM.md b/docs/How-to-Upgrade-from-Standard-GAM.md index 51919d56..94290966 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.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.11 - 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.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.11 - 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/Version-and-Help.md b/docs/Version-and-Help.md index d78b3be7..a4999e97 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.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.11 - 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.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.11 - 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.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource +GAMADV-XTD3 6.65.11 - 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.10 + Latest: 6.65.11 echo $? 1 ``` @@ -73,7 +73,7 @@ echo $? Print the current version number without details ``` gam version simple -6.65.10 +6.65.11 ``` 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.10 - https://github.com/taers232c/GAMADV-XTD3 +GAM 6.65.11 - 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 d150070c..9de35966 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -2,7 +2,7 @@ Merged GAM-Team version -6.65.10 +6.65.11 Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command is interrupted with a contol-C. @@ -10,6 +10,11 @@ is interrupted with a contol-C. multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be N leaked semaphore objects to clean up at shutdown ``` +Fixed bug in `gam print|show crostelemetry` where no CrOS device data was displayed if no selection +options were chosen; now, data is displayed for all CrOS devices as documented. + +6.65.10 + Fixed bug in `gam print crostelemetry` that caused a trap: `KeyError: 'reportTime'`. 6.65.09 diff --git a/src/gam/__init__.py b/src/gam/__init__.py index be534829..682dd442 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -9418,7 +9418,7 @@ def terminateStdQueueHandler(mpQueue, mpQueueHandler): mpQueue.put((0, GM.REDIRECT_QUEUE_EOF, None)) mpQueueHandler.join() -def ProcessGAMCommandMulti(mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr, +def ProcessGAMCommandMulti(pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr, debugLevel, todrive, printAguDomains, printCrosOUs, printCrosOUsAndChildren, output_dateformat, output_timeformat, @@ -9429,6 +9429,8 @@ def ProcessGAMCommandMulti(mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueu csvRowFilter, csvRowFilterMode, csvRowDropFilter, csvRowDropFilterMode, csvRowLimit, args): + global mplock + with mplock: initializeLogging() if sys.platform.startswith('win'): @@ -9523,6 +9525,10 @@ def checkChildProcessRC(rc): return not low <= rc <= high return low <= rc <= high +def initGamWorker(l): + global mplock + mplock = l + def MultiprocessGAMCommands(items, showCmds): def poolCallback(result): poolProcessResults[0] -= 1 @@ -9545,12 +9551,12 @@ def MultiprocessGAMCommands(items, showCmds): parallelPoolProcesses = min(numItems, GC.Values[GC.MULTIPROCESS_POOL_LIMIT]) origSigintHandler = signal.signal(signal.SIGINT, signal.SIG_IGN) mpManager = multiprocessing.Manager() - mplock = mpManager.Lock() + l = mpManager.Lock() try: if multiprocessing.get_start_method() == 'spawn': - pool = mpManager.Pool(processes=numPoolProcesses, maxtasksperchild=200) + pool = mpManager.Pool(processes=numPoolProcesses, initializer=initGamWorker, initargs=(l,), maxtasksperchild=200) else: - pool = multiprocessing.Pool(processes=numPoolProcesses, maxtasksperchild=200) + pool = multiprocessing.Pool(processes=numPoolProcesses, initializer=initGamWorker, initargs=(l,), maxtasksperchild=200) except IOError as e: systemErrorExit(FILE_ERROR_RC, e) except AssertionError as e: @@ -9623,7 +9629,7 @@ def MultiprocessGAMCommands(items, showCmds): else: logCmd = '' poolProcessResults[pid] = pool.apply_async(ProcessGAMCommandMulti, - [mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr, + [pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr, GC.Values[GC.DEBUG_LEVEL], GM.Globals[GM.CSV_TODRIVE], GC.Values[GC.PRINT_AGU_DOMAINS], GC.Values[GC.PRINT_CROS_OUS], GC.Values[GC.PRINT_CROS_OUS_AND_CHILDREN], @@ -24133,6 +24139,8 @@ def doInfoPrintShowCrOSTelemetry(): readMask = ','.join(set(fieldsList)) if csvPF and FJQC.formatJSON: csvPF.SetJSONTitles(['deviceId', 'JSON']) + if not pfilters: + pfilters = [(None, 'All')] for pfilter in pfilters: printGettingAllAccountEntities(Ent.CROS_DEVICE, pfilter[1]) pageMessage = getPageMessage()