Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # This little script creates users in an airflow instance so it can be open to the public.
  4. # It gets the password in plain text so be careful where you run it.
  5. # You can properly invoke the script as follows:
  6. # ./add_user.py <username> <user@email.com> <secretpassword>
  7.  
  8. import airflow, sys
  9. from airflow import models, settings
  10. from airflow.contrib.auth.backends.password_auth import PasswordUser
  11. user = PasswordUser(models.User())
  12. user.username = sys.argv[1]
  13. user.email = sys.argv[2]
  14. user.password = sys.argv[3]
  15. session = settings.Session()
  16. session.add(user)
  17. session.commit()
  18. session.close()
  19. exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement