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): ...@@ -111,12 +111,13 @@ def getUsernameList(config):
def createNewUser(config, name, passwd): def createNewUser(config, name, passwd):
htpasswdfile = os.path.join(config['etc_dir'], '.htpasswd') htpasswdfile = os.path.join(config['etc_dir'], '.htpasswd')
if os.path.exists(htpasswdfile): try:
htpasswd = HtpasswdFile(htpasswdfile) htpasswd = HtpasswdFile(htpasswdfile, new=(not os.path.exists(htpasswdfile)))
htpasswd.set_password(name, passwd) htpasswd.set_password(name, passwd)
htpasswd.save() htpasswd.save()
return True except IOError:
return False return False
return True
def getCurrentSoftwareReleaseProfile(config): 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