First pass at porting scripts/users-from-fas to python3

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2020-06-09 23:17:29 +02:00
parent 5ae974e4cd
commit 491ee01d35

View file

@ -112,11 +112,11 @@ def read_config_files(cfg_files):
if results != True:
for (section_list, key, unused_) in flatten_errors(options, results):
if key is not None:
print 'The "%s" key in the section "%s" failed validation' % (
key, ', '.join(section_list))
print('The "%s" key in the section "%s" failed validation' % (
key, ', '.join(section_list)))
else:
print 'The following section was missing:%s ' % ', '.join(
section_list)
print('The following section was missing:%s ' % ', '.join(
section_list))
sys.exit(1)
return options
@ -153,8 +153,8 @@ def retry_fas(function, *args, **kwargs):
return function(*args, **kwargs)
except AuthError:
retries += 1
password = getpass('FAS Password for %s:' % function.im_self.username)
function.im_self.password = password
password = getpass('FAS Password for %s:' % function.__self__.username)
function.__self__.password = password
if retries >= MAX_RETRIES:
raise
@ -190,4 +190,4 @@ if __name__ == '__main__':
conf['users'].update(members_of_group(group, use_fas=conf['fas_groups']))
for user in sorted(set(conf['users'])):
print user
print(user)