Skip to content

Mitogen eats stderr on async tasks #540

Description

@jbscare

This playbook:

- hosts: localhost
  tasks: 

    - command: ls -Fla /file/not/found
      register: ls_result 
      failed_when: False 

    - debug: var=ls_result 
 
    - command: ls -Fla /file/not/found 
      async: 3600 
      poll: 1 
      register: ls_result 
      failed_when: False 

    - debug: var=ls_result 

With Mitogen (master as of earlier today, 5c5e9fb I believe):

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "delta": "0:00:00.003293", 
        "end": "2019-02-12 21:50:35.381540", 
        "failed": false, 
        "failed_when_result": false, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:50:35.378247", 
        "stderr": "ls: cannot access /file/not/found: No such file or directory", 
        "stderr_lines": [
            "ls: cannot access /file/not/found: No such file or directory"
        ], 
        "stdout": "", 
        "stdout_lines": []
    }
}

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "ansible_job_id": "b445f6d9bb68bfc5", 
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "data": "", 
        "delta": "0:00:00.003631", 
        "end": "2019-02-12 21:50:35.519720", 
        "failed": false, 
        "failed_when_result": false, 
        "finished": 1, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:50:35.516089", 
        "stderr": "", 
        "stderr_lines": [], 
        "stdout": "", 
        "stdout_lines": [], 
        "warnings": []
    }
}

Note that the stderr and stderr_lines parameters are empty for the second task, identical to the first except for async.

With the default linear strategy:

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "delta": "0:00:00.004674", 
        "end": "2019-02-12 21:51:46.849912", 
        "failed": false, 
        "failed_when_result": false, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:51:46.845238", 
        "stderr": "ls: cannot access /file/not/found: No such file or directory", 
        "stderr_lines": [
            "ls: cannot access /file/not/found: No such file or directory"
        ], 
        "stdout": "", 
        "stdout_lines": []
    }
}

TASK [command] *****************************************************************
changed: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] => {
    "ls_result": {
        "ansible_job_id": "655299817323.34046", 
        "changed": true, 
        "cmd": [
            "ls", 
            "-Fla", 
            "/file/not/found"
        ], 
        "delta": "0:00:00.004541", 
        "end": "2019-02-12 21:51:47.121374", 
        "failed": false, 
        "failed_when_result": false, 
        "finished": 1, 
        "msg": "non-zero return code", 
        "rc": 2, 
        "start": "2019-02-12 21:51:47.116833", 
        "stderr": "ls: cannot access /file/not/found: No such file or directory", 
        "stderr_lines": [
            "ls: cannot access /file/not/found: No such file or directory"
        ], 
        "stdout": "", 
        "stdout_lines": []
    }
}

Note identical (except for datestamps, pedantic people) output for both.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions