From 66569328dbbb9c3828c90ac940c2c385d4d5c1e5 Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 1 Apr 2021 09:11:35 -0700 Subject: [PATCH] Updated `gam print|show chromeversions` to avoid a trap where a version was returned without a `version` field. --- src/GamUpdate.txt | 4 ++++ src/gam/__init__.py | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/GamUpdate.txt b/src/GamUpdate.txt index 8afc9da4..87e82417 100644 --- a/src/GamUpdate.txt +++ b/src/GamUpdate.txt @@ -1,3 +1,7 @@ +6.01.01 + +Updated `gam print|show chromeversions` to avoid a trap where a version was returned without a `version` field. + 6.01.00 Added the capability to access two new areas. diff --git a/src/gam/__init__.py b/src/gam/__init__.py index ffb56b89..79b84f14 100755 --- a/src/gam/__init__.py +++ b/src/gam/__init__.py @@ -23,7 +23,7 @@ """ __author__ = 'Ross Scroggs ' -__version__ = '6.01.00' +__version__ = '6.01.01' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' import base64 @@ -20009,6 +20009,8 @@ def doPrintShowChromeVersions(): def _printVersion(version): if showOrgUnit: version['orgUnitPath'] = orgUnitPath + if 'version' not in version: + version['version'] = 'Unknown' if FJQC.formatJSON: if (not csvPF.rowFilter and not csvPF.rowDropFilter) or csvPF.CheckRowTitles(flattenJSON(version)): csvPF.WriteRowNoFilter({'version': version['version'], 'count': version['count'], @@ -20020,6 +20022,8 @@ def _printVersion(version): def _showVersion(version, i=0, count=0): if showOrgUnit: version['orgUnitPath'] = orgUnitPath + if 'version' not in version: + version['version'] = 'Unknown' if FJQC is not None and FJQC.formatJSON: printLine(json.dumps(cleanJSON(version), ensure_ascii=False, sort_keys=True)) else: @@ -20108,12 +20112,12 @@ def _showVersion(version, i=0, count=0): entityPerformActionNumItems([Ent.ORGANIZATIONAL_UNIT, orgUnitPath], jcount, Ent.CHROME_VERSION) Ind.Increment() j = 0 - for version in sorted(versions, key=lambda k: k['version'], reverse=reverse): + for version in sorted(versions, key=lambda k: k.get('version', 'Unknown'), reverse=reverse): j += 1 _showVersion(version, j, jcount) Ind.Decrement() else: - for version in sorted(versions, key=lambda k: k['version'], reverse=reverse): + for version in sorted(versions, key=lambda k: k.get('version', 'Unknown'), reverse=reverse): _printVersion(version) if csvPF: csvPF.writeCSVfile('Chrome Versions')