Commit 3d28f5b5 authored by Nicolas Wavrant's avatar Nicolas Wavrant

slaprunner: createNewUser doesn't depend on slapos to create a htpasswd file

parent 92680783
......@@ -111,12 +111,13 @@ def getUsernameList(config):
def createNewUser(config, name, passwd):
htpasswdfile = os.path.join(config['etc_dir'], '.htpasswd')
if os.path.exists(htpasswdfile):
htpasswd = HtpasswdFile(htpasswdfile)
try:
htpasswd = HtpasswdFile(htpasswdfile, new=(not os.path.exists(htpasswdfile)))
htpasswd.set_password(name, passwd)
htpasswd.save()
return True
return False
except IOError:
return False
return True
def getCurrentSoftwareReleaseProfile(config):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment