First pass at porting scripts/users-from-fas to python3
Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
5ae974e4cd
commit
491ee01d35
1 changed files with 7 additions and 7 deletions
|
@ -112,11 +112,11 @@ def read_config_files(cfg_files):
|
||||||
if results != True:
|
if results != True:
|
||||||
for (section_list, key, unused_) in flatten_errors(options, results):
|
for (section_list, key, unused_) in flatten_errors(options, results):
|
||||||
if key is not None:
|
if key is not None:
|
||||||
print 'The "%s" key in the section "%s" failed validation' % (
|
print('The "%s" key in the section "%s" failed validation' % (
|
||||||
key, ', '.join(section_list))
|
key, ', '.join(section_list)))
|
||||||
else:
|
else:
|
||||||
print 'The following section was missing:%s ' % ', '.join(
|
print('The following section was missing:%s ' % ', '.join(
|
||||||
section_list)
|
section_list))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
@ -153,8 +153,8 @@ def retry_fas(function, *args, **kwargs):
|
||||||
return function(*args, **kwargs)
|
return function(*args, **kwargs)
|
||||||
except AuthError:
|
except AuthError:
|
||||||
retries += 1
|
retries += 1
|
||||||
password = getpass('FAS Password for %s:' % function.im_self.username)
|
password = getpass('FAS Password for %s:' % function.__self__.username)
|
||||||
function.im_self.password = password
|
function.__self__.password = password
|
||||||
if retries >= MAX_RETRIES:
|
if retries >= MAX_RETRIES:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
@ -190,4 +190,4 @@ if __name__ == '__main__':
|
||||||
conf['users'].update(members_of_group(group, use_fas=conf['fas_groups']))
|
conf['users'].update(members_of_group(group, use_fas=conf['fas_groups']))
|
||||||
|
|
||||||
for user in sorted(set(conf['users'])):
|
for user in sorted(set(conf['users'])):
|
||||||
print user
|
print(user)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue