Fixed bug and formatting issues in gam info device <DeviceEntity>.

This commit is contained in:
Ross Scroggs
2026-05-20 11:10:05 -07:00
parent b6a9229a67
commit 6c443fa0c6
2 changed files with 11 additions and 7 deletions

View File

@@ -1,3 +1,7 @@
7.43.08
Fixed bug and formatting issues in `gam info device <DeviceEntity>`.
7.43.07 7.43.07
Improved validation of `<QueryCrOS>`, `<QueryDevice>` and `<QueryMobile>`. Improved validation of `<QueryCrOS>`, `<QueryDevice>` and `<QueryMobile>`.

View File

@@ -25,7 +25,7 @@ https://github.com/GAM-team/GAM/wiki
""" """
__author__ = 'GAM Team <google-apps-manager@googlegroups.com>' __author__ = 'GAM Team <google-apps-manager@googlegroups.com>'
__version__ = '7.43.07' __version__ = '7.43.08'
__license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)' __license__ = 'Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)'
# pylint: disable=wrong-import-position # pylint: disable=wrong-import-position
@@ -31093,7 +31093,7 @@ def getCIDeviceUserEntity():
pageMessage = getPageMessage() pageMessage = getPageMessage()
try: try:
deviceUsers = callGAPIpages(ci.devices().deviceUsers(), 'list', 'deviceUsers', deviceUsers = callGAPIpages(ci.devices().deviceUsers(), 'list', 'deviceUsers',
throwReasons=[GAPI.INVALID, GAPI.PERMISSION_DENIED], throwReasons=[GAPI.INVALID, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS, retryReasons=GAPI.SERVICE_NOT_AVAILABLE_RETRY_REASONS,
pageMessage=pageMessage, pageMessage=pageMessage,
customer=customer, filter=query, parent='devices/-', customer=customer, filter=query, parent='devices/-',
@@ -31102,7 +31102,7 @@ def getCIDeviceUserEntity():
except GAPI.invalid: except GAPI.invalid:
Cmd.Backup() Cmd.Backup()
usageErrorExit(Msg.INVALID_QUERY) usageErrorExit(Msg.INVALID_QUERY)
except GAPI.permissionDenied as e: except (GAPI.invalidArgument, GAPI.permissionDenied) as e:
entityActionFailedWarning([Ent.DEVICE_USER, None], str(e)) entityActionFailedWarning([Ent.DEVICE_USER, None], str(e))
return ([], ci, customer, False) return ([], ci, customer, False)
@@ -31456,7 +31456,7 @@ def doInfoCIDevice():
else: else:
FJQC.GetFormatJSON(myarg) FJQC.GetFormatJSON(myarg)
fields = getFieldsFromFieldsList(fieldsList) fields = getFieldsFromFieldsList(fieldsList)
userFields = getFieldsFromFieldsList(userFieldsList) userFields = getItemFieldsFromFieldsList('deviceUsers', userFieldsList)
i = 0 i = 0
count = len(entityList) count = len(entityList)
for device in entityList: for device in entityList:
@@ -31468,7 +31468,7 @@ def doInfoCIDevice():
name=name, customer=customer, fields=fields) name=name, customer=customer, fields=fields)
if getDeviceUsers: if getDeviceUsers:
device_users = callGAPIpages(ci.devices().deviceUsers(), 'list', 'deviceUsers', device_users = callGAPIpages(ci.devices().deviceUsers(), 'list', 'deviceUsers',
throwReasons=[GAPI.INVALID, GAPI.PERMISSION_DENIED], throwReasons=[GAPI.INVALID, GAPI.INVALID_ARGUMENT, GAPI.PERMISSION_DENIED],
parent=name, customer=customer, fields=userFields) parent=name, customer=customer, fields=userFields)
for device_user in device_users: for device_user in device_users:
device_user['client_states'] = callGAPIpages(ci.devices().deviceUsers().clientStates(), 'list', 'clientStates', device_user['client_states'] = callGAPIpages(ci.devices().deviceUsers().clientStates(), 'list', 'clientStates',
@@ -31492,7 +31492,7 @@ def doInfoCIDevice():
Ind.Increment() Ind.Increment()
showJSON(None, device_user, timeObjects=DEVICE_TIME_OBJECTS) showJSON(None, device_user, timeObjects=DEVICE_TIME_OBJECTS)
Ind.Decrement() Ind.Decrement()
Ind.Decrement() Ind.Decrement()
except GAPI.notFound: except GAPI.notFound:
entityUnknownWarning(Ent.DEVICE, f'{name}') entityUnknownWarning(Ent.DEVICE, f'{name}')
except (GAPI.invalid, GAPI.invalidArgument, GAPI.permissionDenied) as e: except (GAPI.invalid, GAPI.invalidArgument, GAPI.permissionDenied) as e:
@@ -31818,7 +31818,7 @@ def doPrintCIDeviceUsers():
csvPF.WriteRowNoFilter({'name': deviceUser['name'], csvPF.WriteRowNoFilter({'name': deviceUser['name'],
'JSON': json.dumps(cleanJSON(deviceUser, timeObjects=DEVICE_TIME_OBJECTS), 'JSON': json.dumps(cleanJSON(deviceUser, timeObjects=DEVICE_TIME_OBJECTS),
ensure_ascii=False, sort_keys=True)}) ensure_ascii=False, sort_keys=True)})
except (GAPI.invalid, GAPI.permissionDenied) as e: except (GAPI.invalid, GAPI.invalidArgument, GAPI.permissionDenied) as e:
entityActionFailedWarning([Ent.DEVICE_USER, None], str(e)) entityActionFailedWarning([Ent.DEVICE_USER, None], str(e))
break break
if showItemCountOnly: if showItemCountOnly: