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

Removed deprecated code from hashicorp provider #44598

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 11 additions & 0 deletions providers/src/airflow/providers/hashicorp/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
Changelog
---------

main
.....

.. warning::
All deprecated classes, parameters and features have been removed from the hashicorp provider package.
The following breaking changes were introduced:

* The usage of role_id for AppRole authentication has been deprecated from airflow.providers.hashicorp.hook.vault .Please use connection login
* The usage of role_id in connection extra for AppRole authentication has been deprecated from airflow.providers.hashicorp.hook.vault. Please use connection login
* Removed role_id from get_connection_form_widgets method

3.8.0
.....

Expand Down
22 changes: 2 additions & 20 deletions providers/src/airflow/providers/hashicorp/hooks/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
from __future__ import annotations

import json
import warnings
from typing import TYPE_CHECKING, Any

from hvac.exceptions import VaultError

from airflow.exceptions import AirflowProviderDeprecationWarning
from airflow.hooks.base import BaseHook
from airflow.providers.hashicorp._internal_client.vault_client import (
DEFAULT_KUBERNETES_JWT_PATH,
Expand Down Expand Up @@ -70,7 +68,7 @@ class VaultHook(BaseHook):

Login/Password are used as credentials:

* approle: login -> role_id, password -> secret_id
* approle: login -> connection.login
* github: password -> token
* token: password -> token
* aws_iam: login -> key_id, password -> secret_id
Expand Down Expand Up @@ -148,22 +146,7 @@ def __init__(
client_kwargs = merge_dicts(client_kwargs, kwargs)

if auth_type == "approle":
if role_id:
warnings.warn(
"""The usage of role_id for AppRole authentication has been deprecated.
Please use connection login.""",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
elif self.connection.extra_dejson.get("role_id"):
role_id = self.connection.extra_dejson.get("role_id")
warnings.warn(
"""The usage of role_id in connection extra for AppRole authentication has been
deprecated. Please use connection login.""",
AirflowProviderDeprecationWarning,
stacklevel=2,
)
elif self.connection.login:
if self.connection.login:
role_id = self.connection.login

if auth_type == "aws_iam":
Expand Down Expand Up @@ -385,7 +368,6 @@ def get_connection_form_widgets(cls) -> dict[str, Any]:
description="Must be 1 or 2.",
default=DEFAULT_KV_ENGINE_VERSION,
),
"role_id": StringField(lazy_gettext("Role ID (deprecated)"), widget=BS3TextFieldWidget()),
"kubernetes_role": StringField(lazy_gettext("Kubernetes role"), widget=BS3TextFieldWidget()),
"kubernetes_jwt_path": StringField(
lazy_gettext("Kubernetes jwt path"), widget=BS3TextFieldWidget()
Expand Down