diff --git a/airflow/secrets/local_filesystem.py b/airflow/secrets/local_filesystem.py index a7d9e4f2d0a24..40db0b15c4e67 100644 --- a/airflow/secrets/local_filesystem.py +++ b/airflow/secrets/local_filesystem.py @@ -167,7 +167,9 @@ def _parse_secret_file(file_path: str) -> Dict[str, Any]: ext = file_path.rsplit(".", 2)[-1].lower() if ext not in FILE_PARSERS: - raise AirflowException("Unsupported file format. The file must have the extension .env or .json") + raise AirflowException( + "Unsupported file format. The file must have the extension .env or .json or .yaml" + ) secrets, parse_errors = FILE_PARSERS[ext](file_path) @@ -223,7 +225,7 @@ def load_variables(file_path: str) -> Dict[str, str]: """ Load variables from a text file. - Both ``JSON`` and ``.env`` files are supported. + ``JSON``, `YAML` and ``.env`` files are supported. :param file_path: The location of the file that will be processed. :type file_path: str @@ -254,7 +256,7 @@ def load_connections_dict(file_path: str) -> Dict[str, Any]: """ Load connection from text file. - Both ``JSON`` and ``.env`` files are supported. + ``JSON``, `YAML` and ``.env`` files are supported. :return: A dictionary where the key contains a connection ID and the value contains a list of connections. :rtype: Dict[str, airflow.models.connection.Connection] @@ -283,7 +285,7 @@ class LocalFilesystemBackend(BaseSecretsBackend, LoggingMixin): """ Retrieves Connection objects and Variables from local files - Both ``JSON`` and ``.env`` files are supported. + ``JSON``, `YAML` and ``.env`` files are supported. :param variables_file_path: File location with variables data. :type variables_file_path: str diff --git a/docs/security/secrets/secrets-backend/local-filesystem-secrets-backend.rst b/docs/security/secrets/secrets-backend/local-filesystem-secrets-backend.rst index 64b6ced9e76ac..b9b99250f1320 100644 --- a/docs/security/secrets/secrets-backend/local-filesystem-secrets-backend.rst +++ b/docs/security/secrets/secrets-backend/local-filesystem-secrets-backend.rst @@ -60,7 +60,7 @@ The keys ``extra`` and ``extra_dejson`` are mutually exclusive. The JSON file must contain an object where the key contains the connection ID and the value contains the definition of one connection. The connection can be defined as a URI (string) or JSON object. -For a guide about defining a connection as a URI, see:: :ref:`generating_connection_uri`. +For a guide about defining a connection as a URI, see :ref:`generating_connection_uri`. For a description of the connection object parameters see :class:`~airflow.models.connection.Connection`. The following is a sample JSON file.