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

Guidance on tasks that ignore error #3

Open
waded opened this issue Jun 16, 2016 · 1 comment
Open

Guidance on tasks that ignore error #3

waded opened this issue Jun 16, 2016 · 1 comment
Labels

Comments

@waded
Copy link
Contributor

waded commented Jun 16, 2016

Is there any guidance on designing tasks that would ignore errors?

I read task output like this:

TASK [whatever : Shut down something] **********************************************
fatal: [10.140.2.225]: FAILED! => {"changed": false, "failed": true, "msg": "systemd could not find the requested service "'something'": "}
...ignoring

in red and my first thought is WHY is that ignored?

Would it make sense to have guidelines around naming of the task to include the reason for ignored error?, as extra assurance that this is is an 'expected exception' not just a patch around an error condition we don't understand?

E.g. here, if the task was named "Shut down something, ignore since user may have already shut it down" I might feel better.

Or perhaps something is wrong at a higher level with this pattern... perhaps we should have guidance that ignore should never be used UNLESS it is expected exception. It still does end up being red output. :(

@waded waded added the question label Jun 16, 2016
@brikr
Copy link
Contributor

brikr commented Jun 16, 2016

Good point,
I think most of the time the reasoning here is included in the comments of the playbook, which isn't very helpful to the user running the task. This explanation should be moved to the task name.
Additionally, if shell tasks (the most common tasks I've seen ignore_errors: true on) are expected to "fail", the programmer should research ways to make the shell command itself ignore errors, as most programs have options to not fail when something expected goes wrong (e.g. -f option in rm, which will not error if the file does not exist).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants