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

bugraoz 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 ae61b5c731c fix (airflowctl): The Auth fails if credentials aren't 
created already (#49058)
ae61b5c731c is described below

commit ae61b5c731c395393336f6082ce0fd0ff68c5c08
Author: Aritra Basu <24430013+aritr...@users.noreply.github.com>
AuthorDate: Fri Apr 11 12:05:47 2025 +0530

    fix (airflowctl): The Auth fails if credentials aren't created already 
(#49058)
    
    The tests don't catch it because we pass a precreated
    client to it. If it's an auth command it is reasonable
    to expect that the credential file doesn't exist
    and so the credential shouldn't fail on load.
---
 airflow-ctl/src/airflowctl/api/client.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/airflow-ctl/src/airflowctl/api/client.py 
b/airflow-ctl/src/airflowctl/api/client.py
index 43f69d35688..756c4a2c5f0 100644
--- a/airflow-ctl/src/airflowctl/api/client.py
+++ b/airflow-ctl/src/airflowctl/api/client.py
@@ -263,7 +263,9 @@ def get_client(kind: ClientKind = ClientKind.CLI):
     """
     api_client = None
     try:
-        credentials = Credentials().load()
+        credentials = Credentials()
+        if kind == ClientKind.CLI:
+            credentials = credentials.load()
         api_client = Client(
             base_url=credentials.api_url or "http://localhost:8080";,
             limits=httpx.Limits(max_keepalive_connections=1, 
max_connections=1),

Reply via email to