handle empty recoveryPhone (#999)

* handle empty recoveryPhone

* Test empty recoveryemail/recoveryphone

* Handle autoUpdateExpiration for CrOS
This commit is contained in:
Ross Scroggs
2019-08-21 12:03:05 -07:00
committed by Jay Lee
parent 021c3bfb13
commit 1a0f9ab66a
4 changed files with 25 additions and 2 deletions

View File

@@ -178,6 +178,7 @@ script:
- if [ "$e2e" = true ]; then $gam update group $newgroup add member $newuser; fi - if [ "$e2e" = true ]; then $gam update group $newgroup add member $newuser; fi
- if [ "$e2e" = true ]; then $gam csv sample.csv gam create user ~~email~~ firstname "Travis Bulk" lastname ~~email~~ travis.jid $jid; fi - if [ "$e2e" = true ]; then $gam csv sample.csv gam create user ~~email~~ firstname "Travis Bulk" lastname ~~email~~ travis.jid $jid; fi
- if [ "$e2e" = true ]; then $gam csv sample.csv gam update user ~~email~~ recoveryphone 12125121110 recoveryemail jay0lee@gmail.com; fi - if [ "$e2e" = true ]; then $gam csv sample.csv gam update user ~~email~~ recoveryphone 12125121110 recoveryemail jay0lee@gmail.com; fi
- if [ "$e2e" = true ]; then $gam csv sample.csv gam update user ~~email~~ recoveryphone "" recoveryemail ""; fi
- if [ "$e2e" = true ]; then $gam csv sample.csv gam user ~email add license gsuitebusiness; fi - if [ "$e2e" = true ]; then $gam csv sample.csv gam user ~email add license gsuitebusiness; fi
- if [ "$e2e" = true ]; then $gam csv sample.csv gam user $gam_user sendemail recipient ~~email~~@pdl.jaylee.us subject "test message $newbase" message "Travis test message"; fi - if [ "$e2e" = true ]; then $gam csv sample.csv gam user $gam_user sendemail recipient ~~email~~@pdl.jaylee.us subject "test message $newbase" message "Travis test message"; fi
- if [ "$e2e" = true ]; then $gam csv sample.csv gam update group $newgroup add member ~email; fi - if [ "$e2e" = true ]; then $gam csv sample.csv gam update group $newgroup add member ~email; fi

View File

@@ -257,16 +257,20 @@ If an item contains spaces, it should be surrounded by ".
annotatedassetid|assedid|asset| annotatedassetid|assedid|asset|
annotatedlocation|location| annotatedlocation|location|
annotateduser|user| annotateduser|user|
autoupdateexpiration|
bootmode| bootmode|
cpustatusreports| cpustatusreports|
devicefiles| devicefiles|
deviceid| deviceid|
diskvolumereports| diskvolumereports|
dockmacaddress|
ethernetmacaddress| ethernetmacaddress|
ethernetmacaddress0|
firmwareversion| firmwareversion|
lastenrollmenttime| lastenrollmenttime|
lastsync| lastsync|
macaddress| macaddress|
manufacturedate|
meid| meid|
model| model|
notes| notes|
@@ -521,6 +525,8 @@ If an item contains spaces, it should be surrounded by ".
phones|phone| phones|phone|
posixaccounts|posix| posixaccounts|posix|
primaryemail|username| primaryemail|username|
recoveryemail|
recoveryphone|
relations|relation| relations|relation|
ssh|sshkeys|sshpublickeys| ssh|sshkeys|sshpublickeys|
suspended| suspended|
@@ -776,6 +782,8 @@ Specify a collection of Users by directly specifying them or by specifiying item
(note clear|([text_html|text_plain] <String>|(file <FileName> [charset <Charset>])))| (note clear|([text_html|text_plain] <String>|(file <FileName> [charset <Charset>])))|
(org|ou|orgunitpath <OrgUnitPath>) (org|ou|orgunitpath <OrgUnitPath>)
(password random|<Password>)| (password random|<Password>)|
(recoveryemail <EmailAddress>)|
(recoveryphone <string>)|
(suspended <Boolean>)| (suspended <Boolean>)|
(<SchemaName>.<FieldName> [multivalued|multivalue|value|multinonempty [type home|other|work|(custom <String>)]] <String>) (<SchemaName>.<FieldName> [multivalued|multivalue|value|multinonempty [type home|other|work|(custom <String>)]] <String>)
<UserMultiAttributes> ::= <UserMultiAttributes> ::=

View File

@@ -7570,7 +7570,7 @@ def getUserAttributes(i, cd, updateCmd):
i += 2 i += 2
elif myarg in ['recoveryphone']: elif myarg in ['recoveryphone']:
body['recoveryPhone'] = sys.argv[i+1] body['recoveryPhone'] = sys.argv[i+1]
if body['recoveryPhone'][0] != '+': if body['recoveryPhone'] and body['recoveryPhone'][0] != '+':
body['recoveryPhone'] = '+' + body['recoveryPhone'] body['recoveryPhone'] = '+' + body['recoveryPhone']
i += 2 i += 2
elif myarg == 'clearschema': elif myarg == 'clearschema':
@@ -10515,6 +10515,8 @@ def doGetCrosInfo():
print('CrOS Device: {0} ({1} of {2})'.format(deviceId, i, device_count)) print('CrOS Device: {0} ({1} of {2})'.format(deviceId, i, device_count))
if 'notes' in cros: if 'notes' in cros:
cros['notes'] = cros['notes'].replace('\n', '\\n') cros['notes'] = cros['notes'].replace('\n', '\\n')
if 'autoUpdateExpiration' in cros:
cros['autoUpdateExpiration'] = utils.formatTimestampYMD(cros['autoUpdateExpiration'])
_checkTPMVulnerability(cros) _checkTPMVulnerability(cros)
if guess_aue: if guess_aue:
_guessAUE(cros, guessedAUEs) _guessAUE(cros, guessedAUEs)
@@ -12640,6 +12642,8 @@ def doPrintCrosDevices():
for cros in all_cros: for cros in all_cros:
if 'notes' in cros: if 'notes' in cros:
cros['notes'] = cros['notes'].replace('\n', '\\n') cros['notes'] = cros['notes'].replace('\n', '\\n')
if 'autoUpdateExpiration' in cros:
cros['autoUpdateExpiration'] = utils.formatTimestampYMD(cros['autoUpdateExpiration'])
for cpuStatusReport in cros.get('cpuStatusReports', []): for cpuStatusReport in cros.get('cpuStatusReports', []):
for tempInfo in cpuStatusReport.get('cpuTemperatureInfo', []): for tempInfo in cpuStatusReport.get('cpuTemperatureInfo', []):
tempInfo['label'] = tempInfo['label'].strip() tempInfo['label'] = tempInfo['label'].strip()
@@ -12648,6 +12652,8 @@ def doPrintCrosDevices():
for cros in all_cros: for cros in all_cros:
if 'notes' in cros: if 'notes' in cros:
cros['notes'] = cros['notes'].replace('\n', '\\n') cros['notes'] = cros['notes'].replace('\n', '\\n')
if 'autoUpdateExpiration' in cros:
cros['autoUpdateExpiration'] = utils.formatTimestampYMD(cros['autoUpdateExpiration'])
row = {} row = {}
for attrib in cros: for attrib in cros:
if attrib not in set(['kind', 'etag', 'tpmVersionInfo', 'recentUsers', 'activeTimeRanges', if attrib not in set(['kind', 'etag', 'tpmVersionInfo', 'recentUsers', 'activeTimeRanges',

View File

@@ -534,17 +534,21 @@ CROS_ARGUMENT_TO_PROPERTY_MAP = {
'annotateduser': ['annotatedUser',], 'annotateduser': ['annotatedUser',],
'asset': ['annotatedAssetId',], 'asset': ['annotatedAssetId',],
'assetid': ['annotatedAssetId',], 'assetid': ['annotatedAssetId',],
'autoupdateexpiration': ['autoUpdateExpiration',],
'bootmode': ['bootMode',], 'bootmode': ['bootMode',],
'cpustatusreports': ['cpuStatusReports',], 'cpustatusreports': ['cpuStatusReports',],
'devicefiles': ['deviceFiles',], 'devicefiles': ['deviceFiles',],
'deviceid': ['deviceId',], 'deviceid': ['deviceId',],
'dockmacaddress': ['dockMacAddress',],
'diskvolumereports': ['diskVolumeReports',], 'diskvolumereports': ['diskVolumeReports',],
'ethernetmacaddress': ['ethernetMacAddress',], 'ethernetmacaddress': ['ethernetMacAddress',],
'ethernetmacaddress0': ['ethernetMacAddress0',],
'firmwareversion': ['firmwareVersion',], 'firmwareversion': ['firmwareVersion',],
'lastenrollmenttime': ['lastEnrollmentTime',], 'lastenrollmenttime': ['lastEnrollmentTime',],
'lastsync': ['lastSync',], 'lastsync': ['lastSync',],
'location': ['annotatedLocation',], 'location': ['annotatedLocation',],
'macaddress': ['macAddress',], 'macaddress': ['macAddress',],
'manufacturedate': ['manufactureDate',],
'meid': ['meid',], 'meid': ['meid',],
'model': ['model',], 'model': ['model',],
'notes': ['notes',], 'notes': ['notes',],
@@ -586,12 +590,16 @@ CROS_SCALAR_PROPERTY_PRINT_ORDER = [
'osVersion', 'osVersion',
'bootMode', 'bootMode',
'meid', 'meid',
'dockMacAddress',
'ethernetMacAddress', 'ethernetMacAddress',
'ethernetMacAddress0',
'macAddress', 'macAddress',
'systemRamTotal', 'systemRamTotal',
'lastEnrollmentTime', 'lastEnrollmentTime',
'orderNumber', 'orderNumber',
'manufactureDate',
'supportEndDate', 'supportEndDate',
'autoUpdateExpiration',
'guessedAUEDate', 'guessedAUEDate',
'guessedAUEModel', 'guessedAUEModel',
'tpmVersionInfo', 'tpmVersionInfo',