mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 12:51:36 +00:00
print chromeaues/chromeversions cleanup, add print chromeneedsattn (#1598)
* print chromeaues/chromeversions cleanup, add print chromeneedsattn * Fix typo * Define new ChromeOS fields
This commit is contained in:
@@ -1396,6 +1396,9 @@ gam print chromeaues [todrive]
|
|||||||
[ou|org|orgunit <OrgUnitItem>]
|
[ou|org|orgunit <OrgUnitItem>]
|
||||||
[minauedate <Date>] [maxauedate <Date>]
|
[minauedate <Date>] [maxauedate <Date>]
|
||||||
|
|
||||||
|
gam print chromeneedsattn [todrive]
|
||||||
|
[ou|org|orgunit <OrgUnitItem>]
|
||||||
|
|
||||||
gam print chromeversions [todrive]
|
gam print chromeversions [todrive]
|
||||||
[ou|org|orgunit <OrgUnitItem>]
|
[ou|org|orgunit <OrgUnitItem>]
|
||||||
[start <Date>] [end <Date>] [recentfirst]
|
[start <Date>] [end <Date>] [recentfirst]
|
||||||
|
|||||||
@@ -11890,6 +11890,8 @@ def ProcessGAMCommand(args):
|
|||||||
gapi_chromemanagement.printAppDevices()
|
gapi_chromemanagement.printAppDevices()
|
||||||
elif argument in ['chromeaues']:
|
elif argument in ['chromeaues']:
|
||||||
gapi_chromemanagement.printAUEs()
|
gapi_chromemanagement.printAUEs()
|
||||||
|
elif argument in ['chromeneedsattn']:
|
||||||
|
gapi_chromemanagement.printNeedsAttn()
|
||||||
elif argument in ['chromeversions']:
|
elif argument in ['chromeversions']:
|
||||||
gapi_chromemanagement.printVersions()
|
gapi_chromemanagement.printVersions()
|
||||||
elif argument in ['chromehistory']:
|
elif argument in ['chromehistory']:
|
||||||
|
|||||||
@@ -335,14 +335,16 @@ def printAUEs():
|
|||||||
maxAueDate = _getFilterDate(sys.argv[i + 1]).strftime(YYYYMMDD_FORMAT)
|
maxAueDate = _getFilterDate(sys.argv[i + 1]).strftime(YYYYMMDD_FORMAT)
|
||||||
i += 2
|
i += 2
|
||||||
else:
|
else:
|
||||||
msg = f'{myarg} is not a valid argument to "gam print chromeversions"'
|
msg = f'{myarg} is not a valid argument to "gam print chromeaues"'
|
||||||
controlflow.system_error_exit(3, msg)
|
controlflow.system_error_exit(3, msg)
|
||||||
if orgunit:
|
if orgunit:
|
||||||
orgUnitPath = gapi_directory_orgunits.orgunit_from_orgunitid(orgunit, None)
|
orgUnitPath = gapi_directory_orgunits.orgunit_from_orgunitid(orgunit, None)
|
||||||
|
query = f'orgUnitPath={orgUnitPath}'
|
||||||
titles.append('orgUnitPath')
|
titles.append('orgUnitPath')
|
||||||
else:
|
else:
|
||||||
orgUnitPath = '/'
|
orgUnitPath = '/'
|
||||||
gam.printGettingAllItems('Chrome Auto Update Expirations', orgUnitPath)
|
query = None
|
||||||
|
gam.printGettingAllItems('Chrome Auto Update Expirations', query)
|
||||||
aues = gapi.call(cm.customers().reports(),
|
aues = gapi.call(cm.customers().reports(),
|
||||||
'countChromeDevicesReachingAutoExpirationDate',
|
'countChromeDevicesReachingAutoExpirationDate',
|
||||||
customer=customer, orgUnitId=orgunit,
|
customer=customer, orgUnitId=orgunit,
|
||||||
@@ -354,6 +356,48 @@ def printAUEs():
|
|||||||
display.write_csv_file(csvRows, titles, 'Chrome AUEs', todrive)
|
display.write_csv_file(csvRows, titles, 'Chrome AUEs', todrive)
|
||||||
|
|
||||||
|
|
||||||
|
CHROME_NEEDSATTN_TITLES = [
|
||||||
|
'noRecentPolicySyncCount', 'noRecentUserActivityCount', 'pendingUpdate',
|
||||||
|
'osVersionNotCompliantCount', 'unsupportedPolicyCount'
|
||||||
|
]
|
||||||
|
def printNeedsAttn():
|
||||||
|
cm = build()
|
||||||
|
customer = _get_customerid()
|
||||||
|
todrive = False
|
||||||
|
titles = CHROME_NEEDSATTN_TITLES[:]
|
||||||
|
csvRows = []
|
||||||
|
orgunit = None
|
||||||
|
i = 3
|
||||||
|
while i < len(sys.argv):
|
||||||
|
myarg = sys.argv[i].lower().replace('_', '')
|
||||||
|
if myarg == 'todrive':
|
||||||
|
todrive = True
|
||||||
|
i += 1
|
||||||
|
elif myarg in ['ou', 'org', 'orgunit']:
|
||||||
|
orgunit = _get_orgunit(sys.argv[i+1])
|
||||||
|
i += 2
|
||||||
|
else:
|
||||||
|
msg = f'{myarg} is not a valid argument to "gam print chromeneedsattn"'
|
||||||
|
controlflow.system_error_exit(3, msg)
|
||||||
|
if orgunit:
|
||||||
|
orgUnitPath = gapi_directory_orgunits.orgunit_from_orgunitid(orgunit, None)
|
||||||
|
query = f'orgUnitPath={orgUnitPath}'
|
||||||
|
titles.append('orgUnitPath')
|
||||||
|
else:
|
||||||
|
orgUnitPath = '/'
|
||||||
|
query = None
|
||||||
|
gam.printGettingAllItems('Chrome Devices Needing Attention', query)
|
||||||
|
result = gapi.call(cm.customers().reports(),
|
||||||
|
'countChromeDevicesThatNeedAttention',
|
||||||
|
customer=customer, orgUnitId=orgunit, readMask=','.join(CHROME_NEEDSATTN_TITLES))
|
||||||
|
for field in CHROME_NEEDSATTN_TITLES:
|
||||||
|
result.setdefault(field, 0)
|
||||||
|
if orgunit:
|
||||||
|
result['orgUnitPath'] = orgUnitPath
|
||||||
|
csvRows.append(result)
|
||||||
|
display.write_csv_file(csvRows, titles, 'Chrome Devices Needing Attention', todrive)
|
||||||
|
|
||||||
|
|
||||||
CHROME_VERSIONS_TITLES = [
|
CHROME_VERSIONS_TITLES = [
|
||||||
'version', 'count', 'channel', 'deviceOsVersion', 'system'
|
'version', 'count', 'channel', 'deviceOsVersion', 'system'
|
||||||
]
|
]
|
||||||
@@ -367,6 +411,7 @@ def printVersions():
|
|||||||
startDate = None
|
startDate = None
|
||||||
endDate = None
|
endDate = None
|
||||||
pfilter = None
|
pfilter = None
|
||||||
|
query = None
|
||||||
reverse = False
|
reverse = False
|
||||||
i = 3
|
i = 3
|
||||||
while i < len(sys.argv):
|
while i < len(sys.argv):
|
||||||
@@ -397,12 +442,18 @@ def printVersions():
|
|||||||
else:
|
else:
|
||||||
pfilter = ''
|
pfilter = ''
|
||||||
pfilter += f'last_active_date>={startDate}'
|
pfilter += f'last_active_date>={startDate}'
|
||||||
|
query = pfilter
|
||||||
if orgunit:
|
if orgunit:
|
||||||
orgUnitPath = gapi_directory_orgunits.orgunit_from_orgunitid(orgunit, None)
|
orgUnitPath = gapi_directory_orgunits.orgunit_from_orgunitid(orgunit, None)
|
||||||
|
if query:
|
||||||
|
query += ' AND '
|
||||||
|
else:
|
||||||
|
query = ''
|
||||||
|
query += f'orgUnitPath={orgUnitPath}'
|
||||||
titles.append('orgUnitPath')
|
titles.append('orgUnitPath')
|
||||||
else:
|
else:
|
||||||
orgUnitPath = '/'
|
orgUnitPath = '/'
|
||||||
gam.printGettingAllItems('Chrome Versions', pfilter)
|
gam.printGettingAllItems('Chrome Versions', query)
|
||||||
page_message = gapi.got_total_items_msg('Chrome Versions', '...\n')
|
page_message = gapi.got_total_items_msg('Chrome Versions', '...\n')
|
||||||
versions = gapi.get_all_pages(cm.customers().reports(),
|
versions = gapi.get_all_pages(cm.customers().reports(),
|
||||||
'countChromeVersions',
|
'countChromeVersions',
|
||||||
|
|||||||
@@ -984,6 +984,8 @@ CROS_ARGUMENT_TO_PROPERTY_MAP = {
|
|||||||
'autoupdateexpiration': ['autoUpdateExpiration',],
|
'autoupdateexpiration': ['autoUpdateExpiration',],
|
||||||
'bootmode': ['bootMode',],
|
'bootmode': ['bootMode',],
|
||||||
'cpustatusreports': ['cpuStatusReports',],
|
'cpustatusreports': ['cpuStatusReports',],
|
||||||
|
'deprovisionreason': ['deprovisionReason',],
|
||||||
|
'lastDeprovisionTimestamp': ['lastDeprovisionTimestamp',],
|
||||||
'devicefiles': ['deviceFiles',],
|
'devicefiles': ['deviceFiles',],
|
||||||
'deviceid': ['deviceId',],
|
'deviceid': ['deviceId',],
|
||||||
'dockmacaddress': ['dockMacAddress',],
|
'dockmacaddress': ['dockMacAddress',],
|
||||||
@@ -991,6 +993,7 @@ CROS_ARGUMENT_TO_PROPERTY_MAP = {
|
|||||||
'ethernetmacaddress': ['ethernetMacAddress',],
|
'ethernetmacaddress': ['ethernetMacAddress',],
|
||||||
'ethernetmacaddress0': ['ethernetMacAddress0',],
|
'ethernetmacaddress0': ['ethernetMacAddress0',],
|
||||||
'firmwareversion': ['firmwareVersion',],
|
'firmwareversion': ['firmwareVersion',],
|
||||||
|
'firstenrollmenttime': ['firstEnrollmentTime',],
|
||||||
'lastenrollmenttime': ['lastEnrollmentTime',],
|
'lastenrollmenttime': ['lastEnrollmentTime',],
|
||||||
'lastknownnetwork': ['lastKnownNetwork'],
|
'lastknownnetwork': ['lastKnownNetwork'],
|
||||||
'lastsync': ['lastSync',],
|
'lastsync': ['lastSync',],
|
||||||
@@ -1048,7 +1051,10 @@ CROS_SCALAR_PROPERTY_PRINT_ORDER = [
|
|||||||
'ethernetMacAddress0',
|
'ethernetMacAddress0',
|
||||||
'macAddress',
|
'macAddress',
|
||||||
'systemRamTotal',
|
'systemRamTotal',
|
||||||
|
'firstEnrollmentTime',
|
||||||
'lastEnrollmentTime',
|
'lastEnrollmentTime',
|
||||||
|
'deprovisionReason',
|
||||||
|
'lastDeprovisionTimestamp',
|
||||||
'orderNumber',
|
'orderNumber',
|
||||||
'manufactureDate',
|
'manufactureDate',
|
||||||
'supportEndDate',
|
'supportEndDate',
|
||||||
|
|||||||
Reference in New Issue
Block a user