X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fimport_users_from_passwd.py;h=a9dacd349a99966f19af0d88faaccc1169abca50;hb=6cc75beccd14c9b39621cb5894d67cec24750405;hp=958486710251b99e5ac5e2ebf5a6cf75efef37b2;hpb=0872b2e0b78670c91fd2bf0bda52e5761e079820;p=dak.git diff --git a/dak/import_users_from_passwd.py b/dak/import_users_from_passwd.py index 95848671..a9dacd34 100755 --- a/dak/import_users_from_passwd.py +++ b/dak/import_users_from_passwd.py @@ -115,7 +115,12 @@ def main (): # NB: I never figured out how to use a bind parameter for this query # XXX: Fix this as it looks like a potential SQL injection attack to me # (hence the safe_name match we do) - q = session.execute('CREATE USER "%s"' % (uname)) + try: + q = session.execute('CREATE USER "%s"' % (uname)) + session.commit() + except Exception as e: + utils.warn("Could not create user %s (%s)" % (uname, str(e))) + session.rollback() else: print "NOT CREATING USER %s. Doesn't match safety regex" % uname