daily pastebin goal


a guest Oct 3rd, 2017 414 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  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>
  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()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand