Add info printer command/ChromePolicy cleanup (#1337)

* Add info printer command

* ChromePolicy cleanup

Make update chromepolicy orgunit default to / like delete and print
Add `filter <String>` to print chromeschema
Make update_policy code to set additionalTargetKeys consistent with delete_policy

I left verb at print for chromepolicy/chromeschema

* When printing schemasa, use ":" instead of " - "

* Fix print policy indentation

* Chrome policy cleanup

orgunit must be specified
Use verb show, add verb print later

* Recognize all ou forms to exit from schema mode

* Don't assign multiple variables on same line
This commit is contained in:
Ross Scroggs
2021-03-19 09:46:07 -07:00
committed by GitHub
parent a65635365e
commit 6f2ebf8d2d
4 changed files with 66 additions and 37 deletions

View File

@@ -82,6 +82,19 @@ def delete():
for printer_id in result.get('failedPrinters', []):
print(f'ERROR: failed to delete {printer_id.get("printerIds")}')
def info():
'''gam info printer'''
cdapi = gapi_directory.build()
customer = _get_customerid()
printer_id = sys.argv[3]
name = f'{customer}/chrome/printers/{printer_id}'
result = gapi.call(cdapi.customers().chrome().printers(),
'get',
name=name)
display.print_json(result)
def print_():
'''gam print printers'''
cdapi = gapi_directory.build()
@@ -161,8 +174,8 @@ def update():
update_mask = ','.join(body)
# note clearMask seems unnecessary. Updating field to '' clears it.
result = gapi.call(cdapi.customers().chrome().printers(),
'patch',
name=name,
updateMask=update_mask,
body=body)
'patch',
name=name,
updateMask=update_mask,
body=body)
display.print_json(result)