Added option max_to_deprov <Integer> to gam update cros <CrOSEntity> action <CrOSAction>

This commit is contained in:
Ross Scroggs
2026-05-15 16:51:40 -07:00
parent f75d7d78f6
commit bb9d5b3cdc
4 changed files with 30 additions and 7 deletions

View File

@@ -2469,9 +2469,9 @@ gam print chromehistory releases [todrive <ToDriveAttribute>*]
pre_provisioned_reenable pre_provisioned_reenable
gam update cros <CrOSEntity> action <CrOSAction> [acknowledge_device_touch_requirement] gam update cros <CrOSEntity> action <CrOSAction> [acknowledge_device_touch_requirement]
[actionbatchsize <Integer>] [actionbatchsize <Integer>] [maxtodeprov <Integer>]
gam <CrOSTypeEntity> update action <CrOSAction> [acknowledge_device_touch_requirement] gam <CrOSTypeEntity> update action <CrOSAction> [acknowledge_device_touch_requirement]
[actionbatchsize <Integer>] [actionbatchsize <Integer>] [maxtodeprov <Integer>]
<CrOSCommand> <CrOSCommand>
reboot| reboot|

View File

@@ -4,6 +4,19 @@ Added option `matchfield attendeesorganizer <Boolean> <EmailAddressEntity>` to `
that is used in commands that process events. The match is true if all of the addresses in `<EmailAddressEntity>` that is used in commands that process events. The match is true if all of the addresses in `<EmailAddressEntity>`
are present as attendees in the event and are an organizer or not based on `<Boolean>`. are present as attendees in the event and are an organizer or not based on `<Boolean>`.
Added option `max_to_deprov <Integer>` to `gam update cros <CrOSEntity> action <CrOSAction>`
that is used when `<CrOSAction>` is any of the following:
```
deprovision_different_model_replace|
deprovision_different_model_replacement|
deprovision_retiring_device|
deprovision_same_model_replace|
deprovision_same_model_replacement|
deprovision_upgrade_transfer
```
`max_to_deprov <Integer>` - No deprovisions are processed if the number of devices in `<CrOSEntity>` exceeds `<Integer>`;
the default value is one; set `<Integer>` to 0 for no limit.
7.43.04 7.43.04
Added option `include_suspended_zeros [<Boolean>]` to `gam print vaultcounts` that causes Added option `include_suspended_zeros [<Boolean>]` to `gam print vaultcounts` that causes
@@ -22,7 +35,7 @@ gam <UserTypeEntity> print filelist ... filepath|fullpath
7.43.02 7.43.02
Added option `maxactivities <Number>` to `gam <UserTypeEntity> print driveactivity` to limit Added option `maxactivities <Integer>` to `gam <UserTypeEntity> print driveactivity` to limit
the number of activities displayed; the default is 0, no limit. the number of activities displayed; the default is 0, no limit.
7.43.01 7.43.01

View File

@@ -24210,7 +24210,7 @@ CROS_ACTION_NAME_MAP = {
# gam <CrOSTypeEntity> update <CrOSAttribute>+ [quickcrosmove [<Boolean>]] [nobatchupdate] # gam <CrOSTypeEntity> update <CrOSAttribute>+ [quickcrosmove [<Boolean>]] [nobatchupdate]
# gam <CrOSTypeEntity> update action <CrOSAction> [acknowledge_device_touch_requirement] # gam <CrOSTypeEntity> update action <CrOSAction> [acknowledge_device_touch_requirement]
# [actionbatchsize <Integer>] # [actionbatchsize <Integer>] [maxtodeprov <Integer>]
def updateCrOSDevices(entityList): def updateCrOSDevices(entityList):
cd = buildGAPIObject(API.DIRECTORY) cd = buildGAPIObject(API.DIRECTORY)
noBatchUpdate = False noBatchUpdate = False
@@ -24220,6 +24220,7 @@ def updateCrOSDevices(entityList):
ackWipe = False ackWipe = False
quickCrOSMove = GC.Values[GC.QUICK_CROS_MOVE] quickCrOSMove = GC.Values[GC.QUICK_CROS_MOVE]
actionBatchSize = 10 actionBatchSize = 10
maxToDeprovision = None
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
myarg = getArgument() myarg = getArgument()
if myarg in UPDATE_CROS_ARGUMENT_TO_PROPERTY_MAP: if myarg in UPDATE_CROS_ARGUMENT_TO_PROPERTY_MAP:
@@ -24245,6 +24246,8 @@ def updateCrOSDevices(entityList):
noBatchUpdate = getBoolean() noBatchUpdate = getBoolean()
elif myarg == 'actionbatchsize': elif myarg == 'actionbatchsize':
actionBatchSize = getInteger(minVal=10, maxVal=250) actionBatchSize = getInteger(minVal=10, maxVal=250)
elif myarg == 'maxtodeprov':
maxToDeprovision = getInteger(minVal=0)
else: else:
unknownArgumentExit() unknownArgumentExit()
if action_body and update_body: if action_body and update_body:
@@ -24258,9 +24261,15 @@ def updateCrOSDevices(entityList):
i, count, entityList = getEntityArgument(entityList) i, count, entityList = getEntityArgument(entityList)
# Action # Action
if action_body: if action_body:
if action_body['changeChromeOsDeviceStatusAction'] == 'CHANGE_CHROME_OS_DEVICE_STATUS_ACTION_DEPROVISION' and not ackWipe: if action_body['changeChromeOsDeviceStatusAction'] == 'CHANGE_CHROME_OS_DEVICE_STATUS_ACTION_DEPROVISION':
stderrWarningMsg(Msg.REFUSING_TO_DEPROVISION_DEVICES.format(count)) if not ackWipe:
systemErrorExit(ACTION_NOT_PERFORMED_RC, None) stderrWarningMsg(Msg.REFUSING_TO_DEPROVISION_DEVICES.format(count))
systemErrorExit(ACTION_NOT_PERFORMED_RC, None)
if maxToDeprovision is None:
maxToDeprovision = 1
if count > maxToDeprovision > 0:
stderrWarningMsg(Msg.REFUSING_TO_DEPROVISION_N_DEVICES.format(count, maxToDeprovision))
systemErrorExit(ACTION_NOT_PERFORMED_RC, None)
while i < count: while i < count:
bcount = min(count-i, actionBatchSize) bcount = min(count-i, actionBatchSize)
action_body['deviceIds'] = entityList[i:i+bcount] action_body['deviceIds'] = entityList[i:i+bcount]

View File

@@ -474,6 +474,7 @@ REASON_ONLY_VALID_WITH_CONTENTRESTRICTIONS_READONLY_TRUE = 'reason only valid wi
REAUTHENTICATION_IS_NEEDED = 'Reauthentication is needed, please run\n\ngam oauth create' REAUTHENTICATION_IS_NEEDED = 'Reauthentication is needed, please run\n\ngam oauth create'
RECOMMEND_RUNNING_GAM_ROTATE_SAKEY = 'Recommend running "gam rotate sakey" to get a new key\n' RECOMMEND_RUNNING_GAM_ROTATE_SAKEY = 'Recommend running "gam rotate sakey" to get a new key\n'
REFUSING_TO_DEPROVISION_DEVICES = 'Refusing to deprovision {0} devices because acknowledge_device_touch_requirement not specified.\nDeprovisioning a device means the device will have to be physically wiped and re-enrolled to be managed by your domain again.\nThis requires physical access to the device and is very time consuming to perform for each device.\nPlease add "acknowledge_device_touch_requirement" to the GAM command if you understand this and wish to proceed with the deprovision.\nPlease also be aware that deprovisioning can have an effect on your device license count.\nSee https://support.google.com/chrome/a/answer/3523633 for full details.' REFUSING_TO_DEPROVISION_DEVICES = 'Refusing to deprovision {0} devices because acknowledge_device_touch_requirement not specified.\nDeprovisioning a device means the device will have to be physically wiped and re-enrolled to be managed by your domain again.\nThis requires physical access to the device and is very time consuming to perform for each device.\nPlease add "acknowledge_device_touch_requirement" to the GAM command if you understand this and wish to proceed with the deprovision.\nPlease also be aware that deprovisioning can have an effect on your device license count.\nSee https://support.google.com/chrome/a/answer/3523633 for full details.'
REFUSING_TO_DEPROVISION_N_DEVICES = 'Refusing to deprovision {0} devices due to maxtodepov {1}.'
REPLY_TO_CUSTOM_REQUIRES_EMAIL_ADDRESS = 'replyto REPLY_TO_CUSTOM requires customReplyTo <EmailAddress>' REPLY_TO_CUSTOM_REQUIRES_EMAIL_ADDRESS = 'replyto REPLY_TO_CUSTOM requires customReplyTo <EmailAddress>'
REQUEST_COMPLETED_NO_FILES = 'Request completed but no results/files were returned, try requesting again' REQUEST_COMPLETED_NO_FILES = 'Request completed but no results/files were returned, try requesting again'
REQUEST_NOT_COMPLETE = 'Request needs to be completed before downloading, current status is: {0}' REQUEST_NOT_COMPLETE = 'Request needs to be completed before downloading, current status is: {0}'