Created
October 3, 2017 08:18
-
-
Save dinigo/c86c66b31c44d8f85571bb0e8d2106ca to your computer and use it in GitHub Desktop.
Revisions
-
dinigo created this gist
Oct 3, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ #!/usr/bin/python # This little script creates users in an airflow instance so it can be open to the public. # It gets the password in plain text so be careful where you run it. # You can properly invoke the script as follows: # ./add_user.py <username> <[email protected]> <secretpassword> import airflow, sys from airflow import models, settings from airflow.contrib.auth.backends.password_auth import PasswordUser user = PasswordUser(models.User()) user.username = sys.argv[1] user.email = sys.argv[2] user.password = sys.argv[3] session = settings.Session() session.add(user) session.commit() session.close() exit()