olayiwola-gbenga commented on code in PR #70681:
URL: https://github.com/apache/airflow/pull/70681#discussion_r4142799868


##########
airflow-core/src/airflow/configuration.py:
##########
@@ -760,17 +761,17 @@ def initialize_secrets_backends(
         from airflow.models import Connection
 
         custom_secret_backend._set_connection_class(Connection)
-        backend_list.append(custom_secret_backend)
+        backend_list.append((Backend.CUSTOM, custom_secret_backend))
 
     for class_name in default_backends:
         from airflow.models import Connection
 
         secrets_backend_cls = import_string(class_name)
         backend = secrets_backend_cls()
         backend._set_connection_class(Connection)
-        backend_list.append(backend)
+        backend_list.append((Backend.from_path(class_name), backend))
 
-    return backend_list
+    return sorted_backends(conf, backend_list, worker_mode)

Review Comment:
   Good catch, thank you! Because `secrets_backend_list = 
initialize_secrets_backends()` runs at module import time at the bottom of 
`configuration.py`, any config error in `backends_order` crashes every CLI 
command on startup.
   We will make `secrets_backend_list` load lazily on first secret lookup via 
`ensure_secrets_loaded()` so commands like `airflow config get-value` and 
`airflow version` still work when `backends_order` is misconfigured.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to