teamclairvoyant/airflow-rest-api-plugin

variable --set fails with "argument -s/--set: expected 2 arguments\n'"

ahsanshah opened this issue · 1 comments

Seems the --set does not work with the 1.0.4 branch. I am entering KEY VALUE (space in between) on the Airflow Admin UI.

I found that the following function fails:
process = subprocess.Popen(airflow_cmd_split, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

In my case airflow_cmd_split shows as "key value". However for this to work the subprocess needs "key, value" as 2 inputs.

Temporarily I can get around this with the following change:

def execute_cli_command(airflow_cmd_split):
    **if (airflow_cmd_split[2] == "--set"):
        airflow_cmd_split = ['airflow', 'variables', '--set', airflow_cmd_split[3].split()[0],airflow_cmd_split[3].split()[1]]**

Can this be corrected in the main codebase?

Fixed this issue in 1.0.5 branch and it will be ready in the next release.