hussein-awala commented on code in PR #36492:
URL: https://github.com/apache/airflow/pull/36492#discussion_r1445490642


##########
airflow/jobs/triggerer_job_runner.py:
##########
@@ -708,3 +710,16 @@ def get_trigger_by_classpath(self, classpath: str) -> 
type[BaseTrigger]:
         if classpath not in self.trigger_cache:
             self.trigger_cache[classpath] = import_string(classpath)
         return self.trigger_cache[classpath]
+
+    def trigger_row_to_trigger_instance(self, trigger_row: Trigger, 
trigger_class: type[U]) -> U:
+        """Convert a Trigger row into a Trigger instance."""
+        from airflow.models.crypto import get_fernet
+
+        decrypted_kwargs = {}
+        fernet = get_fernet()
+        for k, v in trigger_row.kwargs.items():
+            if k.startswith("encrypted__"):
+                decrypted_kwargs[k[11:]] = 
fernet.decrypt(v.encode("utf-8")).decode("utf-8")

Review Comment:
   The idea is to store the kwarg key in the db with the prefix to know which 
one we should decrypt when we re-create the trigger, but the trigger __init__ 
should consume the kwarg without this prefix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to