You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ds...@apache.org on 2022/04/22 00:33:16 UTC

[airflow] branch main updated: Fix false warnings re non-JSON extra params (#23157)

This is an automated email from the ASF dual-hosted git repository.

dstandish pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 9efcd64041 Fix false warnings re non-JSON extra params (#23157)
9efcd64041 is described below

commit 9efcd64041e2e4439ec875cea8256c8bd72609e1
Author: Daniel Standish <15...@users.noreply.github.com>
AuthorDate: Thu Apr 21 17:33:10 2022 -0700

    Fix false warnings re non-JSON extra params (#23157)
    
    We were validating JSON-serializability on the fernet-encoded value, which of course won't be JSON-serializable!
---
 airflow/models/connection.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/airflow/models/connection.py b/airflow/models/connection.py
index 6b8f1fa4b5..8134f372ca 100644
--- a/airflow/models/connection.py
+++ b/airflow/models/connection.py
@@ -297,9 +297,9 @@ class Connection(Base, LoggingMixin):
     def set_extra(self, value: str):
         """Encrypt extra-data and save in object attribute to object."""
         if value:
+            self._validate_extra(value, self.conn_id)
             fernet = get_fernet()
             self._extra = fernet.encrypt(bytes(value, 'utf-8')).decode()
-            self._validate_extra(self._extra, self.conn_id)
             self.is_extra_encrypted = fernet.is_encrypted
         else:
             self._extra = value