Skip to content

Commit

Permalink
Updated gam print|show chromeversions to avoid a trap where a versi…
Browse files Browse the repository at this point in the history
…on was returned without a `version` field.
  • Loading branch information
taers232c committed Apr 1, 2021
1 parent 3f56a31 commit 6656932
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/GamUpdate.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 7 additions & 3 deletions src/gam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"""

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

import base64
Expand Down Expand Up @@ -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'],
Expand All @@ -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:
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 6656932

Please sign in to comment.