Skip to content

Commit

Permalink
Make AwsAuthManager compatible with only Airflow >= 2.9 (#40690)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincbeck authored Jul 10, 2024
1 parent 5d36f27 commit 224cb75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
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

0 comments on commit 224cb75

Please sign in to comment.