Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reported AIX filesystem module incorrect fail_json() usage #58642

Merged
merged 2 commits into from
Jul 11, 2019

Conversation

mator
Copy link
Contributor

@mator mator commented Jul 2, 2019

SUMMARY

Fix reported AIX filesystem module incorrect fail_json() usage and extend reporting on an error.

Fixes #58609

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

aix_filesystem

ADDITIONAL INFORMATION
$ ansible aix7 -m aix_filesystem -a "filesystem=/mnt/exp1 state=mounted"  
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: fail_json() takes exactly 1 argument (4 given)
aix7 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "module_stderr": "Shared connection to aix7 closed.\r\n", 
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/.ansible/tmp/ansible-tmp-1562092525.37-233239812793604/AnsiballZ_aix_filesystem.py\", line 125, in <module>\r\n    _ansiballz_main()\r\n  File \"/.ansible/tmp/ansible-tmp-1562092525.37-233239812793604/AnsiballZ_aix_filesystem.py\", line 117, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/.ansible/tmp/ansible-tmp-1562092525.37-233239812793604/AnsiballZ_aix_filesystem.py\", line 54, in invoke_module\r\n    imp.load_module('__main__', mod, module, MOD_DESC)\r\n  File \"/tmp/ansible_aix_filesystem_payload_bQ1ysS/__main__.py\", line 579, in <module>\r\n  File \"/tmp/ansible_aix_filesystem_payload_bQ1ysS/__main__.py\", line 561, in main\r\n  File \"/tmp/ansible_aix_filesystem_payload_bQ1ysS/__main__.py\", line 430, in mount_fs\r\nTypeError: fail_json() takes exactly 1 argument (4 given)\r\n", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 1
}

after:

$ ansible aix7 -m aix_filesystem -a "filesystem=/mnt/exp1 state=mounted"
aix7 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "msg": "Failed to run mount. Error message: mount: 0506-334 /mnt/exp1 is not a known file system.\n"
}


$ ansible aix7 -m aix_filesystem -a "filesystem=/mnt/exp1 state=present"
aix7 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    }, 
    "changed": false, 
    "msg": "Required parameter \"device\" and/or \"vg\" is missing for filesystem creation."
}

@ansibot
Copy link
Contributor

ansibot commented Jul 2, 2019

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/modules/system/aix_filesystem.py:367:21: E126 continuation line over-indented for hanging indent

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/system/aix_filesystem.py:8:0: E106 Import found before documentation variables. All imports must appear below DOCUMENTATION/EXAMPLES/RETURN/ANSIBLE_METADATA.

click here for bot help

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 aix AIX community bug This issue/PR relates to a bug. ci_verified Changes made in this PR are causing tests to fail. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. owner_pr This PR is made by the module's maintainer. support:community This issue/PR relates to code supported by the Ansible community. system System category traceback This issue/PR includes a traceback. labels Jul 2, 2019
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jul 2, 2019
@ansibot
Copy link
Contributor

ansibot commented Jul 11, 2019

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 11, 2019
@d-little
Copy link
Contributor

LGTM

@ansibot ansibot added shipit This PR is ready to be merged by Core automerge This PR was automatically merged by ansibot. and removed community_review In order to be merged, this PR must follow the community review workflow. needs_triage Needs a first human triage before being processed. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jul 11, 2019
@ansibot ansibot merged commit 75724bb into ansible:devel Jul 11, 2019
@ansible ansible locked and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 aix AIX community automerge This PR was automatically merged by ansibot. bug This issue/PR relates to a bug. module This issue/PR relates to a module. owner_pr This PR is made by the module's maintainer. shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. system System category traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aix_filesystem.py - fail_json() missing msg=
3 participants