Skip to content

Commit

Permalink
fix: sync-users for airflow 2.7.0 (#772)
Browse files Browse the repository at this point in the history
* fix: update User, Role import to support Airflow 2.7.0

Signed-off-by: Sam Wheating <[email protected]>

* fix: clarify comments for each version

Signed-off-by: Mathew Wicks <[email protected]>

---------

Signed-off-by: Sam Wheating <[email protected]>
Signed-off-by: Mathew Wicks <[email protected]>
Co-authored-by: Mathew Wicks <[email protected]>
  • Loading branch information
SamWheating and thesuperzapper authored Aug 29, 2023
1 parent 696e613 commit 773dbf8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions charts/airflow/templates/sync/_helpers/sync_users.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ flask_app = www_app.create_app()
flask_appbuilder = flask_app.appbuilder
{{- end }}

# airflow uses its own incompatible FAB models in 2.3.0+
# airflow moves the User and Role models around in different versions
try:
from airflow.www.fab_security.sqla.models import User, Role
# since 2.7.0
from airflow.auth.managers.fab.models import User, Role
except ModuleNotFoundError:
from flask_appbuilder.security.sqla.models import User, Role
try:
# from 2.3.0 to 2.6.3
from airflow.www.fab_security.sqla.models import User, Role
except ModuleNotFoundError:
# before 2.3.0
from flask_appbuilder.security.sqla.models import User, Role


#############
Expand Down

0 comments on commit 773dbf8

Please sign in to comment.