You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "sksirajbasha (via GitHub)" <gi...@apache.org> on 2023/11/24 10:11:41 UTC

Re: [I] Unable to create a WinRM Connection with apache-airflow-providers-microsoft-winrm installed [airflow]

sksirajbasha commented on issue #19739:
URL: https://github.com/apache/airflow/issues/19739#issuecomment-1825437401

   Not sure if this is the right thread. The winrm connection with this provider always fails. IT works via Rundeck when used with same credentials. Errs out with airflow for the same server and creds. Error: 
   
   enterprise-airflow-worker-567cd9f6d8-8ptn2
   *** Found local files:
   ***   * /opt/airflow/logs/dag_id=winrm_connection_test/run_id=manual__2023-11-24T10:04:01.385245+00:00/task_id=wintask3/attempt=1.log
   [2023-11-24, 10:04:03 UTC] {taskinstance.py:1103} INFO - Dependencies all met for dep_context=non-requeueable deps ti=<TaskInstance: winrm_connection_test.wintask3 manual__2023-11-24T10:04:01.385245+00:00 [queued]>
   [2023-11-24, 10:04:03 UTC] {taskinstance.py:1103} INFO - Dependencies all met for dep_context=requeueable deps ti=<TaskInstance: winrm_connection_test.wintask3 manual__2023-11-24T10:04:01.385245+00:00 [queued]>
   [2023-11-24, 10:04:03 UTC] {taskinstance.py:1308} INFO - Starting attempt 1 of 1
   [2023-11-24, 10:04:03 UTC] {taskinstance.py:1327} INFO - Executing <Task(WinRMOperator): wintask3> on 2023-11-24 10:04:01.385245+00:00
   [2023-11-24, 10:04:03 UTC] {standard_task_runner.py:57} INFO - Started process 11745 to run task
   [2023-11-24, 10:04:03 UTC] {standard_task_runner.py:84} INFO - Running: ['airflow', 'tasks', 'run', 'winrm_connection_test', 'wintask3', 'manual__2023-11-24T10:04:01.385245+00:00', '--job-id', '1455343', '--raw', '--subdir', 'DAGS_FOLDER/winrm_connect_cmd.py', '--cfg-path', '/tmp/tmp5aafbaf1']
   [2023-11-24, 10:04:03 UTC] {standard_task_runner.py:85} INFO - Job 1455343: Subtask wintask3
   [2023-11-24, 10:04:03 UTC] {task_command.py:410} INFO - Running <TaskInstance: winrm_connection_test.wintask3 manual__2023-11-24T10:04:01.385245+00:00 [running]> on host enterprise-airflow-worker-567cd9f6d8-8ptn2
   [2023-11-24, 10:04:03 UTC] {taskinstance.py:1545} INFO - Exporting env vars: AIRFLOW_CTX_DAG_OWNER='airflow' AIRFLOW_CTX_DAG_ID='winrm_connection_test' AIRFLOW_CTX_TASK_ID='wintask3' AIRFLOW_CTX_EXECUTION_DATE='2023-11-24T10:04:01.385245+00:00' AIRFLOW_CTX_TRY_NUMBER='1' AIRFLOW_CTX_DAG_RUN_ID='manual__2023-11-24T10:04:01.385245+00:00'
   [2023-11-24, 10:04:03 UTC] {base.py:73} INFO - Using connection ID 'windows_<hostname>' for task execution.
   [2023-11-24, 10:04:03 UTC] {winrm.py:211} INFO - Establishing WinRM connection to host: <hostname>
   [2023-11-24, 10:04:03 UTC] {winrm.py:216} ERROR - Error connecting to host: <hostname>, error: the specified credentials were rejected by the server
   [2023-11-24, 10:04:04 UTC] {taskinstance.py:1824} ERROR - Task failed with exception
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.10/site-packages/winrm/transport.py", line 328, in _send_message_request
       response.raise_for_status()
     File "/home/airflow/.local/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
       raise HTTPError(http_error_msg, response=self)
   requests.exceptions.HTTPError: 401 Client Error:  for url: http://<hostname>:5985/wsman
   During handling of the above exception, another exception occurred:
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/microsoft/winrm/hooks/winrm.py", line 212, in get_conn
       self.client = self.winrm_protocol.open_shell()
     File "/home/airflow/.local/lib/python3.10/site-packages/winrm/protocol.py", line 166, in open_shell
       res = self.send_message(xmltodict.unparse(req))
     File "/home/airflow/.local/lib/python3.10/site-packages/winrm/protocol.py", line 243, in send_message
       resp = self.transport.send_message(message)
     File "/home/airflow/.local/lib/python3.10/site-packages/winrm/transport.py", line 322, in send_message
       response = self._send_message_request(prepared_request, message)
     File "/home/airflow/.local/lib/python3.10/site-packages/winrm/transport.py", line 332, in _send_message_request
       raise InvalidCredentialsError("the specified credentials were rejected by the server")
   winrm.exceptions.InvalidCredentialsError: the specified credentials were rejected by the server
   During handling of the above exception, another exception occurred:
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/microsoft/winrm/operators/winrm.py", line 93, in execute
       winrm_client = self.winrm_hook.get_conn()
     File "/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/microsoft/winrm/hooks/winrm.py", line 217, in get_conn
       raise AirflowException(error_msg)
   airflow.exceptions.AirflowException: Error connecting to host: <hostname>, error: the specified credentials were rejected by the server
   [2023-11-24, 10:04:04 UTC] {taskinstance.py:1345} INFO - Marking task as FAILED. dag_id=winrm_connection_test, task_id=wintask3, execution_date=20231124T100401, start_date=20231124T100403, end_date=20231124T100404
   [2023-11-24, 10:04:04 UTC] {standard_task_runner.py:104} ERROR - Failed to execute job 1455343 for task wintask3 (Error connecting to host: <hostname>, error: the specified credentials were rejected by the server; 11745)
   [2023-11-24, 10:04:04 UTC] {local_task_job_runner.py:225} INFO - Task exited with return code 1
   [2023-11-24, 10:04:04 UTC] {taskinstance.py:2653} INFO - 0 downstream tasks scheduled from follow-on schedule check
   Version: [v2.6.2](https://pypi.python.org/pypi/apache-airflow/2.6.2)
   Git Version: .release:d2f0d100dac4a95d664309d7b04a6a6110367446


-- 
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-unsubscribe@airflow.apache.org

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