Comment 8 for bug 1466982

Revision history for this message
Kevin Carter (kevin-carter) wrote :

Sadly the rabbitmq user module doesn't return data consistently in both a success and failure scenario so there's no easy way to intelligently allow the module to fail if there is an issue. In this case, because we're looking to simply nuke the guest user, I'm thinking the `failed_when: false` option is the best way forward but I'm also open to a better way if we can think of one.

Data from the module for success and failure:
ok: [aio1_rabbit_mq_container-bb27526c] => {
    "var": {
        "rabbitguest": {
            "cmd": "/usr/sbin/rabbitmqctl -q -n rabbit delete_user guest",
            "failed": false,
            "failed_when_result": false,
            "invocation": {
                "module_args": "",
                "module_name": "rabbitmq_user"
            },
            "msg": "Error: no_such_user: guest",
            "rc": 2,
            "stderr": "Error: no_such_user: guest\n",
            "stdout": "",
            "stdout_lines": []
        }
    }
}
ok: [aio1_rabbit_mq_container-5d9b0cfc] => {
    "var": {
        "rabbitguest": {
            "changed": true,
            "failed": false,
            "failed_when_result": false,
            "invocation": {
                "module_args": "",
                "module_name": "rabbitmq_user"
            },
            "state": "absent",
            "user": "guest"
        }
    }
}
ok: [aio1_rabbit_mq_container-e8e4279d] => {
    "var": {
        "rabbitguest": {
            "cmd": "/usr/sbin/rabbitmqctl -q -n rabbit delete_user guest",
            "failed": false,
            "failed_when_result": false,
            "invocation": {
                "module_args": "",
                "module_name": "rabbitmq_user"
            },
            "msg": "Error: no_such_user: guest",
            "rc": 2,
            "stderr": "Error: no_such_user: guest\n",
            "stdout": "",
            "stdout_lines": []
        }
    }
}