Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AwsAuthManager compatible with only Airflow >= 2.9 #40690

Merged
merged 3 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ class AwsAuthManager(BaseAuthManager):
"""

def __init__(self, appbuilder: AirflowAppBuilder) -> None:
from packaging.version import Version

from airflow.version import version

# TODO: remove this if block when min_airflow_version is set to higher than 2.9.0
if Version(version) < Version("2.9"):
raise AirflowOptionalProviderFeatureException(
"``AwsAuthManager`` is compatible with Airflow versions >= 2.9."
)

super().__init__(appbuilder)
self._check_avp_schema_version()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from flask import Flask, session
from flask_appbuilder.menu import MenuItem

from tests.test_utils.compat import AIRFLOW_V_2_8_PLUS
from tests.test_utils.compat import AIRFLOW_V_2_8_PLUS, AIRFLOW_V_2_9_PLUS

try:
from airflow.auth.managers.models.resource_details import (
Expand Down Expand Up @@ -66,6 +66,8 @@
if TYPE_CHECKING:
from airflow.auth.managers.base_auth_manager import ResourceMethod

pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires Airflow 2.9+")

mock = Mock()

SAML_METADATA_PARSED = {
Expand Down
4 changes: 2 additions & 2 deletions tests/providers/amazon/aws/auth_manager/views/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

from airflow.exceptions import AirflowException
from airflow.www import app as application
from tests.test_utils.compat import AIRFLOW_V_2_8_PLUS
from tests.test_utils.compat import AIRFLOW_V_2_9_PLUS
from tests.test_utils.config import conf_vars

pytest.importorskip("onelogin")

pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_8_PLUS, reason="Test requires Airflow 2.8+")
pytestmark = pytest.mark.skipif(not AIRFLOW_V_2_9_PLUS, reason="Test requires Airflow 2.9+")


SAML_METADATA_URL = "/saml/metadata"
Expand Down