Make gam info crostelemetry <SerialNumber> (#1464)

* Make gam info crostelemetry <SerialNumber>

* Handle missing <SerialNumber> for gam info crostelemetry
This commit is contained in:
Ross Scroggs
2021-12-29 11:48:57 -08:00
committed by GitHub
parent 1777c762b3
commit 8bf8d45ebe
3 changed files with 15 additions and 4 deletions

View File

@@ -203,7 +203,7 @@ def printAppDevices():
display.write_csv_file(csvRows, titles, 'Chrome Installed Application Devices', todrive)
def printShowCrosTelemetry(show=False):
def printShowCrosTelemetry(mode):
cm = build()
cd = None
parent = _get_customerid()
@@ -217,6 +217,12 @@ def printShowCrosTelemetry(show=False):
supported_readmask_values.sort()
supported_readmask_map = {item.lower():item for item in supported_readmask_values}
i = 3
if mode == 'info':
if i >= len(sys.argv):
controlflow.system_error_exit(3, f'<SerialNumber> required for "gam info crostelemetry"')
filter_ = f'serialNumber={sys.argv[i]}'
i += 1
mode = 'show'
while i < len(sys.argv):
myarg = sys.argv[i].lower().replace('_', '')
if myarg == 'fields':
@@ -286,7 +292,7 @@ def printShowCrosTelemetry(show=False):
if orgUnitId not in orgUnitIdPathMap:
orgUnitIdPathMap[orgUnitId] = gapi_directory_orgunits.orgunit_from_orgunitid(orgUnitId, cd)
device['orgUnitPath'] = orgUnitIdPathMap[orgUnitId]
if show:
if mode == 'show':
for device in devices:
display.print_json(device)
print()