diff --git a/airflow/security/kerberos.py b/airflow/security/kerberos.py index 2729a07f1ab66..81d627fdbac26 100644 --- a/airflow/security/kerberos.py +++ b/airflow/security/kerberos.py @@ -60,7 +60,7 @@ class KerberosMode(Enum): ONE_TIME = "one-time" -def get_kerberos_principle(principal: str | None) -> str: +def get_kerberos_principal(principal: str | None) -> str: """Retrieve Kerberos principal. Fallback to principal from Airflow configuration if not provided.""" return principal or conf.get_mandatory_value("kerberos", "principal").replace("_HOST", get_hostname()) @@ -77,7 +77,7 @@ def renew_from_kt(principal: str | None, keytab: str, exit_on_fail: bool = True) # minutes to give ourselves a large renewal buffer. renewal_lifetime = f"{conf.getint('kerberos', 'reinit_frequency')}m" - cmd_principal = get_kerberos_principle(principal) + cmd_principal = get_kerberos_principal(principal) if conf.getboolean("kerberos", "forwardable"): forwardable = "-f" else: diff --git a/newsfragments/43679.misc.rst b/newsfragments/43679.misc.rst new file mode 100644 index 0000000000000..792087dc63a75 --- /dev/null +++ b/newsfragments/43679.misc.rst @@ -0,0 +1 @@ +Renamed ``airflow.security.kerberos.get_kerberos_principle`` to ``airflow.security.kerberos.get_kerberos_principal`` due to misspelling. diff --git a/tests/security/test_kerberos.py b/tests/security/test_kerberos.py index 1153ac61a7983..ce80238199d88 100644 --- a/tests/security/test_kerberos.py +++ b/tests/security/test_kerberos.py @@ -24,7 +24,7 @@ import pytest from airflow.security import kerberos -from airflow.security.kerberos import get_kerberos_principle, renew_from_kt +from airflow.security.kerberos import get_kerberos_principal, renew_from_kt from tests_common.test_utils.config import conf_vars @@ -285,13 +285,13 @@ def test_run(self, mock_sleep, mock_renew_from_kt): mock.call("test-principal", "/tmp/keytab"), ] - def test_get_kerberos_principle(self): + def test_get_kerberos_principal(self): expected_principal = "test-principal" - principal = get_kerberos_principle(expected_principal) + principal = get_kerberos_principal(expected_principal) assert principal == expected_principal @mock.patch("airflow.security.kerberos.get_hostname", return_value="REPLACEMENT_HOST") @mock.patch("airflow.security.kerberos.conf.get_mandatory_value", return_value="test-principal/_HOST") - def test_get_kerberos_principle_resolve_null_principal(self, get_madantory_value_mock, get_hostname_mock): - principal = get_kerberos_principle(principal=None) + def test_get_kerberos_principal_resolve_null_principal(self, get_madantory_value_mock, get_hostname_mock): + principal = get_kerberos_principal(principal=None) assert principal == "test-principal/REPLACEMENT_HOST"