Fixed bug in gam update chromepolicy where appid was misinterpreted
Some checks failed
Build and test GAM / build (Win64, build, 10, VC-WIN64A, windows-2022) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 3, linux-aarch64, ubuntu-24.04-arm) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 4, linux-aarch64, ubuntu-22.04-arm) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 6, linux-aarch64, ubuntu-22.04-arm, yes) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 8, darwin64-arm64, macos-14) (push) Has been cancelled
Build and test GAM / build (aarch64, build, 9, darwin64-arm64, macos-15) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 1, linux-x86_64, ubuntu-22.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 2, linux-x86_64, ubuntu-24.04) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 5, linux-x86_64, ubuntu-22.04, yes) (push) Has been cancelled
Build and test GAM / build (x86_64, build, 7, darwin64-x86_64, macos-13) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 11, ubuntu-24.04, 3.10) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 12, ubuntu-24.04, 3.11) (push) Has been cancelled
Build and test GAM / build (x86_64, test, 13, ubuntu-24.04, 3.12) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Check for Google Root CA Updates / check-apis (push) Has been cancelled
Build and test GAM / merge (push) Has been cancelled
Build and test GAM / publish (push) Has been cancelled

This commit is contained in:
Ross Scroggs
2025-03-18 23:20:51 -07:00
parent be0dcbc8d4
commit 212460b636
2 changed files with 24 additions and 16 deletions

View File

@@ -1,4 +1,12 @@
7.05.11 7.05.12
Fixed bug in `gam update chromepolicy` where `appid` was misinterpreted for `chrome.devices.kiosk` policies
and an error was generated.
```
ERROR: Chrome Policy Schema: customers/C123abc456/policySchemas/<Field>, Does not exist
```
!7.05.11
Added the following License SKUs: Added the following License SKUs:
``` ```

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.05.11' __version__ = '7.05.12'
__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
@@ -28202,6 +28202,7 @@ def doUpdateChromePolicy():
schemaName, schema = simplifyChromeSchema(_getChromePolicySchema(cp, Cmd.Previous(), '*')) schemaName, schema = simplifyChromeSchema(_getChromePolicySchema(cp, Cmd.Previous(), '*'))
body['requests'].append({'policyValue': {'policySchema': schemaName, 'value': {}}, body['requests'].append({'policyValue': {'policySchema': schemaName, 'value': {}},
'updateMask': ''}) 'updateMask': ''})
schemaNameList.append(schemaName)
while Cmd.ArgumentsRemaining(): while Cmd.ArgumentsRemaining():
field = getArgumentEmptyAllowed() field = getArgumentEmptyAllowed()
# Allow an empty field/value pair which makes processing an input CSV file with schemas with different numbers of fields easy # Allow an empty field/value pair which makes processing an input CSV file with schemas with different numbers of fields easy
@@ -28210,6 +28211,7 @@ def doUpdateChromePolicy():
Cmd.Advance() Cmd.Advance()
continue continue
if field in {'ou', 'org', 'orgunit', 'group', 'printerid', 'appid'} or '.' in field: if field in {'ou', 'org', 'orgunit', 'group', 'printerid', 'appid'} or '.' in field:
if field != 'appid' or not schemaName.startswith('chrome.devices.kiosk'):
Cmd.Backup() Cmd.Backup()
break # field is actually a new policy name or orgunit break # field is actually a new policy name or orgunit
# JSON # JSON
@@ -28222,7 +28224,7 @@ def doUpdateChromePolicy():
body['requests'][-1]['policyTargetKey']['additionalTargetKeys'] = {atk['name']: atk['value']} body['requests'][-1]['policyTargetKey']['additionalTargetKeys'] = {atk['name']: atk['value']}
if atk['name'] == 'app_id': if atk['name'] == 'app_id':
schemaNameAppId += f"({atk['value']})" schemaNameAppId += f"({atk['value']})"
schemaNameList.append(schemaNameAppId) schemaNameList[-1] = schemaNameAppId
for field in jsonData.get('fields', []): for field in jsonData.get('fields', []):
casedField = field['name'] casedField = field['name']
lowerField = casedField.lower() lowerField = casedField.lower()
@@ -28263,7 +28265,6 @@ def doUpdateChromePolicy():
body['requests'][-1]['policyValue']['value'][casedField] = value body['requests'][-1]['policyValue']['value'][casedField] = value
body['requests'][-1]['updateMask'] += f'{casedField},' body['requests'][-1]['updateMask'] += f'{casedField},'
break break
schemaNameList.append(schemaName)
# Handle TYPE_MESSAGE fields with durations, values, counts and timeOfDay as special cases # Handle TYPE_MESSAGE fields with durations, values, counts and timeOfDay as special cases
tmschema = CHROME_SCHEMA_TYPE_MESSAGE.get(schemaName, {}).get(field) tmschema = CHROME_SCHEMA_TYPE_MESSAGE.get(schemaName, {}).get(field)
if tmschema: if tmschema:
@@ -42476,15 +42477,15 @@ class PasswordOptions():
up = 'password' up = 'password'
password = self.GetPassword() password = self.GetPassword()
if password: if password:
notFoundBody[up] = password if password.lower() == 'blocklogin':
if notFoundBody[up].lower() in {'blocklogin'}:
self.makeCleanPassword = False self.makeCleanPassword = False
notFoundBody[up] = self.CreateRandomPassword() notFoundBody[up] = self.CreateRandomPassword()
self.notFoundPassword = notFoundBody[up] elif password.lower() in {'random', 'uniquerandom'}:
elif notFoundBody[up].lower() in {'random', 'uniquerandom'}:
self.SetCleanPasswordLen() self.SetCleanPasswordLen()
self.makeCleanPassword = True self.makeCleanPassword = True
notFoundBody[up] = self.CreateRandomPassword() notFoundBody[up] = self.CreateRandomPassword()
else:
notFoundBody[up] = password
self.notFoundPassword = notFoundBody[up] self.notFoundPassword = notFoundBody[up]
elif myarg in {'lograndompassword', 'logpassword'}: elif myarg in {'lograndompassword', 'logpassword'}:
self.filename = getString(Cmd.OB_FILE_NAME) self.filename = getString(Cmd.OB_FILE_NAME)
@@ -42528,6 +42529,8 @@ class PasswordOptions():
self.promptForUniquePassword = True self.promptForUniquePassword = True
else: else:
self.promptForPassword = True self.promptForPassword = True
else:
self.password = password
elif up == 'hashFunction': elif up == 'hashFunction':
body[up] = self.HASH_FUNCTION_MAP[myarg] body[up] = self.HASH_FUNCTION_MAP[myarg]
self.clearPassword = self.hashPassword = False self.clearPassword = self.hashPassword = False
@@ -43240,9 +43243,7 @@ def doCreateUser():
cd = buildGAPIObject(API.DIRECTORY) cd = buildGAPIObject(API.DIRECTORY)
body, notify, tagReplacements, addGroups, addAliases, PwdOpts, \ body, notify, tagReplacements, addGroups, addAliases, PwdOpts, \
_, _, _, \ _, _, _, \
parameters, resolveConflictAccount = getUserAttributes(cd, parameters, resolveConflictAccount = getUserAttributes(cd, False, noUid=True)
False,
noUid=True)
suffix = 0 suffix = 0
originalEmail = body['primaryEmail'] originalEmail = body['primaryEmail']
atLoc = originalEmail.find('@') atLoc = originalEmail.find('@')
@@ -43350,8 +43351,7 @@ def updateUsers(entityList):
updateRetryDelay = 5 updateRetryDelay = 5
body, notify, tagReplacements, addGroups, addAliases, PwdOpts, \ body, notify, tagReplacements, addGroups, addAliases, PwdOpts, \
updatePrimaryEmail, notFoundBody, groupOrgUnitMap, \ updatePrimaryEmail, notFoundBody, groupOrgUnitMap, \
parameters, resolveConflictAccount = getUserAttributes(cd, parameters, resolveConflictAccount = getUserAttributes(cd, True)
True)
vfe = 'primaryEmail' in body and body['primaryEmail'][:4].lower() == 'vfe@' vfe = 'primaryEmail' in body and body['primaryEmail'][:4].lower() == 'vfe@'
if body.get('orgUnitPath', '') and parameters['immutableOUs']: if body.get('orgUnitPath', '') and parameters['immutableOUs']:
ubody = body.copy() ubody = body.copy()