Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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> <user@email.com> <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()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement