-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Connection creation from Vault parameters
Currently using the Vault secrets backends requires that users store the secrets in connection URI format: https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#connection-uri-format Unfortunately the connection URI format is not capable of expressing all values of the Connection class. In particular the Connection class allows for arbitrary string values for the `extra` parameter, while the URI format requires that this parameter be unnested JSON so that it can serialize into query parameters. ``` >>> Connection(conn_id='id', conn_type='http', extra='foobar').get_uri() [2021-03-25 13:31:07,535] {connection.py:337} ERROR - Expecting value: line 1 column 1 (char 0) Traceback (most recent call last): File "/Users/da.lum/code/python/airflow/airflow/models/connection.py", line 335, in extra_dejson obj = json.loads(self.extra) File "/nix/store/8kzdflq0v06fq0mh9m2fd73gnyqp57xr-python3-3.7.3/lib/python3.7/json/__init__.py", line 348, in loads return _default_decoder.decode(s) File "/nix/store/8kzdflq0v06fq0mh9m2fd73gnyqp57xr-python3-3.7.3/lib/python3.7/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/nix/store/8kzdflq0v06fq0mh9m2fd73gnyqp57xr-python3-3.7.3/lib/python3.7/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) [2021-03-25 13:31:07,535] {connection.py:338} ERROR - Failed parsing the json for conn_id id 'http://' ``` As shown, the `extra` data is missing from the return value `http://`. Although there is an error logged, this does not help users who were previously able to store other data.
- Loading branch information
Showing
3 changed files
with
124 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters