mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-04 04:41:35 +00:00
Add cros_ou and cros_ou_and_children to <CrOSTypeEntity> (#1538)
* Add cros_ou and cros_ou_and_children to <CrOSTypeEntity> Most useful here: `gam update org|ou <OrgUnitPath> add|move <CrOSTypeEntity>` * Update GamCommands.txt * Code cleanup/appease pylint
This commit is contained in:
@@ -653,7 +653,8 @@ Specify a collection of ChromeOS devices by directly specifying them
|
|||||||
(crosfile <FileName>)|
|
(crosfile <FileName>)|
|
||||||
(croscsvfile <FileName>:<FieldName>)|
|
(croscsvfile <FileName>:<FieldName>)|
|
||||||
(crosquery <QueryCrOS>)|
|
(crosquery <QueryCrOS>)|
|
||||||
(crosqueries <QueryCrOSList>)
|
(crosqueries <QueryCrOSList>)|
|
||||||
|
(cros_ou|cros_ou_and_children <OrgUnitPath>)
|
||||||
|
|
||||||
## Collections of Users
|
## Collections of Users
|
||||||
|
|
||||||
@@ -1331,7 +1332,7 @@ gam <CrOSTypeEntity> print
|
|||||||
Summary of printing:
|
Summary of printing:
|
||||||
gam print cros
|
gam print cros
|
||||||
Prints a header row and deviceId for all CrOS devices.
|
Prints a header row and deviceId for all CrOS devices.
|
||||||
gam <CrOSTypeEntity> print cros
|
gam <CrOSTypeEntity> print
|
||||||
Prints no header row and deviceId for specified CrOS devices.
|
Prints no header row and deviceId for specified CrOS devices.
|
||||||
gam print cros ... basic|full
|
gam print cros ... basic|full
|
||||||
Prints a header row and selected fields for specified CrOS devices.
|
Prints a header row and selected fields for specified CrOS devices.
|
||||||
|
|||||||
@@ -7854,12 +7854,11 @@ def doCreateOrRotateServiceAccountKeys(iam=None,
|
|||||||
body={'publicKeyData': publicKeyData})
|
body={'publicKeyData': publicKeyData})
|
||||||
break
|
break
|
||||||
except googleapiclient.errors.HttpError as err:
|
except googleapiclient.errors.HttpError as err:
|
||||||
if hasattr(err, 'error_details') and \
|
if hasattr(err, 'error_details'):
|
||||||
err.error_details == 'The given public key already exists.':
|
if err.error_details == 'The given public key already exists.':
|
||||||
print('WARNING: that key already exists.')
|
print('WARNING: that key already exists.')
|
||||||
result = {'name': oldPrivateKeyId}
|
result = {'name': oldPrivateKeyId}
|
||||||
break
|
break
|
||||||
elif hasattr(err, 'error_details'):
|
|
||||||
controlflow.system_error_exit(
|
controlflow.system_error_exit(
|
||||||
4, err.error_details)
|
4, err.error_details)
|
||||||
else:
|
else:
|
||||||
@@ -10294,8 +10293,13 @@ def getUsersToModify(entity_type=None,
|
|||||||
elif entity_type == 'cros':
|
elif entity_type == 'cros':
|
||||||
users = entity.replace(',', ' ').split()
|
users = entity.replace(',', ' ').split()
|
||||||
entity = 'cros'
|
entity = 'cros'
|
||||||
elif entity_type in ['crosquery', 'crosqueries', 'cros_sn']:
|
elif entity_type in ['crosquery', 'crosqueries', 'cros_sn', 'cros_ou', 'cros_ou_and_children']:
|
||||||
if entity_type == 'cros_sn':
|
orgUnitPath = includeChildOrgunits = None
|
||||||
|
if entity_type in {'cros_ou', 'cros_ou_and_children'}:
|
||||||
|
orgUnitPath = entity
|
||||||
|
includeChildOrgunits = entity_type == 'cros_ou_and_children'
|
||||||
|
queries = [None]
|
||||||
|
elif entity_type == 'cros_sn':
|
||||||
queries = [f'id:{sn}' for sn in shlexSplitList(entity)]
|
queries = [f'id:{sn}' for sn in shlexSplitList(entity)]
|
||||||
elif entity_type == 'crosqueries':
|
elif entity_type == 'crosqueries':
|
||||||
queries = shlexSplitList(entity)
|
queries = shlexSplitList(entity)
|
||||||
@@ -10312,9 +10316,11 @@ def getUsersToModify(entity_type=None,
|
|||||||
'list',
|
'list',
|
||||||
'chromeosdevices',
|
'chromeosdevices',
|
||||||
page_message=page_message,
|
page_message=page_message,
|
||||||
|
query=query,
|
||||||
customerId=GC_Values[GC_CUSTOMER_ID],
|
customerId=GC_Values[GC_CUSTOMER_ID],
|
||||||
fields='nextPageToken,chromeosdevices(deviceId)',
|
orgUnitPath=orgUnitPath,
|
||||||
query=query)
|
includeChildOrgunits=includeChildOrgunits,
|
||||||
|
fields='nextPageToken,chromeosdevices(deviceId)')
|
||||||
for member in members:
|
for member in members:
|
||||||
deviceId = member['deviceId']
|
deviceId = member['deviceId']
|
||||||
if deviceId not in usersSet:
|
if deviceId not in usersSet:
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ usergroup_types = [
|
|||||||
'ou_and_child', 'ou_and_children_ns', 'ou_and_child_ns',
|
'ou_and_child', 'ou_and_children_ns', 'ou_and_child_ns',
|
||||||
'ou_and_children_susp', 'ou_and_child_susp', 'query', 'queries', 'license',
|
'ou_and_children_susp', 'ou_and_child_susp', 'query', 'queries', 'license',
|
||||||
'licenses', 'licence', 'licences', 'file', 'csv', 'csvfile', 'all', 'cros',
|
'licenses', 'licence', 'licences', 'file', 'csv', 'csvfile', 'all', 'cros',
|
||||||
'cros_sn', 'crosquery', 'crosqueries', 'crosfile', 'croscsv', 'croscsvfile'
|
'cros_sn', 'crosquery', 'crosqueries', 'crosfile', 'croscsv', 'croscsvfile',
|
||||||
|
'cros_ou', 'cros_ou_and_children'
|
||||||
]
|
]
|
||||||
ERROR_PREFIX = 'ERROR: '
|
ERROR_PREFIX = 'ERROR: '
|
||||||
WARNING_PREFIX = 'WARNING: '
|
WARNING_PREFIX = 'WARNING: '
|
||||||
|
|||||||
Reference in New Issue
Block a user