Airflow: Error in SSHOperator " 'NoneType' object has no attribute 'startswith' "

Created on 31 Aug 2020  路  7Comments  路  Source: apache/airflow

Apache Airflow version: 1.10.10

What happened:

I wrote the following piece of code:

from datetime import datetime
from airflow import DAG
from airflow.contrib.operators.ssh_operator import SSHOperator


args = {
    'owner': 'airflow',
    'start_date': datetime(year=2020, month=7, day=21,
                           hour=3, minute=0, second=0),
    'provide_context': True,
}

dag = DAG(
    dag_id='test_ssh_operator',
    default_args=args,
    schedule_interval='@daily',
)

ssh_command = """
echo 'hello work'
"""
task = SSHOperator(
    task_id="check_ssh_perator",
    ssh_conn_id='ssh_default',
    command=ssh_command,
    do_xcom_push=True,
    dag=dag,
)

task

What you expected to happen:
And I got the following error:

Broken DAG: [/etc/airflow/dags/dag_test_sshoperator.py] 'NoneType' object has no attribute 'startswith'

Anything else we need to know:
I add new ssh connection in Admin--> Connections. and in Extra field, I put the following JSON:

{"key_file":"/root/.ssh/airflow-connector/id_ed25519",
"timeout": "10",
"compress": "false",
"no_host_key_check": "false",
"allow_host_key_change": "false"}

providers bug

Most helpful comment

Let us know if you need any help @MahsaSeifikar

All 7 comments

Thanks for opening your first issue here! Be sure to follow the issue template!

This looks like real issue. Do I have to assign you to this ticket? Would you like to contribute a fix for this problem? I happy to help with review.

This looks like real issue. Do I have to assign you to this ticket? Would you like to contribute a fix for this problem? I happy to help with review.

Yup, I know what's the problem. and I really like to fix this issue!

hmm I thought this was fixed, just needs to add some validation at https://github.com/apache/airflow/blob/master/airflow/providers/ssh/operators/ssh.py#L80

Assigning this issue to you @MahsaSeifikar looking forward for the PR

Let us know if you need any help @MahsaSeifikar

@MahsaSeifikar Thank you bringing this up. I'm running into the same issue. Have you had a chance since to fix the validate?

I have created a PR to fix this: https://github.com/apache/airflow/pull/11361

Was this page helpful?
0 / 5 - 0 ratings