diff --git a/bin/sid_user.py b/bin/sid_user.py index 5bea449604a33c43dc40062e334369a9872f4d08..d33c10ebae9d90e13660e0176012758421c2bf91 100755 --- a/bin/sid_user.py +++ b/bin/sid_user.py @@ -874,19 +874,20 @@ def main(): sid_d_results = diego.diego_run_dieget_by_name('sid_department_check', params) logger.info(sid_d_results[1]) - for user in sid_d_results[1][department]['has as member']: - if user in devnull_del_user: - logger.debug("Skipping the user in the dev_null:" + user) - continue - if user not in snet_account_index: - logger.error('SID user ' + user + ' should be deleted. Need to ask SEE ?') + if 'has as member' in sid_d_results[1][department] and sid_d_results[1][department]['has as member'] is not None: + for user in sid_d_results[1][department]['has as member']: + if user in devnull_del_user: + logger.debug("Skipping the user in the dev_null:" + user) + continue + if user not in snet_account_index: + logger.error('SID user ' + user + ' should be deleted. Need to ask SEE ?') for user in snet_account_index: if user in devnull_user: continue if 'departmentNumber' in ec_results['users'][user] and ec_results['users'][user]['departmentNumber'] != department: continue - if user not in sid_d_results[1][department]['has as member']: + if 'has as member' in sid_d_results[1][department] and sid_d_results[1][department]['has as member'] is not None: logger.info('SID user ' + user + ' should be addded to department ' + department + '.') if not dryrun: logger.info('dryrun')