Skip to content

Conversation

@vincbeck
Copy link
Contributor

@vincbeck vincbeck commented Jan 6, 2025

As part of AIP-79.

The Flask application in FAB provider should not use any Flask related resources from core Airflow. Otherwise, deleting the main Flask application in core Airflow when the legacy Airflow 2 is gone will be impossible.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@vincbeck vincbeck force-pushed the vincbeck/fab_extensions branch 5 times, most recently from 7eb4744 to 3294c71 Compare January 6, 2025 22:21
@vincbeck vincbeck force-pushed the vincbeck/fab_extensions branch from 3294c71 to f3e31ca Compare January 6, 2025 23:13

if TYPE_CHECKING:
from airflow.www.extensions.init_appbuilder import AirflowAppBuilder
from airflow.providers.fab.www.extensions.init_appbuilder import AirflowAppBuilder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincbeck We don't have add_permissions() method in from airflow.providers.fab.www.extensions.init_appbuilder import AirflowAppBuilder class. Causing airflow sync-perm command to fail on the main branch.

Updating actions and resources for all existing roles
webserver  | Traceback (most recent call last):
webserver  |   File "/usr/local/bin/airflow", line 8, in <module>
webserver  |     sys.exit(main())
webserver  |              ^^^^^^
webserver  |   File "/usr/local/lib/python3.12/site-packages/airflow/__main__.py", line 58, in main
webserver  |     args.func(args)
webserver  |   File "/usr/local/lib/python3.12/site-packages/airflow/cli/cli_config.py", line 49, in command
webserver  |     return func(*args, **kwargs)
webserver  |            ^^^^^^^^^^^^^^^^^^^^^
webserver  |   File "/usr/local/lib/python3.12/site-packages/airflow/utils/cli.py", line 111, in wrapper
webserver  |     return f(*args, **kwargs)
webserver  |            ^^^^^^^^^^^^^^^^^^
webserver  |   File "/usr/local/lib/python3.12/site-packages/airflow/utils/providers_configuration_loader.py", line 55, in wrapped_function
webserver  |     return func(*args, **kwargs)
webserver  |            ^^^^^^^^^^^^^^^^^^^^^
webserver  |   File "/usr/local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/cli_commands/sync_perm_command.py", line 35, in sync_perm
webserver  |     appbuilder.add_permissions(update_perms=True)
webserver  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
webserver  | AttributeError: 'AirflowAppBuilder' object has no attribute 'add_permissions'. Did you mean: '_add_permission'?

Is there an alternative method we should use?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it still happening? The solution would be to copy over add_permissions from core Airflow to FAB provider

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vincbeck, I have created a PR for the same. PTAL - #45611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants