diff --git a/slapos/runner/utils.py b/slapos/runner/utils.py index 8ec428e0e17e0a8f9bc3f47e0e508b7cc54927d2..3ffc057e5df104a7d2095883be0cedb8c4fb95c9 100644 --- a/slapos/runner/utils.py +++ b/slapos/runner/utils.py @@ -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): """