pyinfra
pyinfra copied to clipboard
Fact errors during "Preparing Operations" mark host as failed even if fact will later succeed
Describe the bug
bauen1:
Okay, using facts does work, kind of, they are evaluated at the right time, but if I now have a fact that will error if run at the beginning, then that prevents the deployment from running, even if a later fact collection (in my case /etc/krb5.keytab population) would be successful probably user error
bauen1:
Actually, not so certain it's my fault anymore, the fact is loaded during --> Preparing Operations... and not _run_fact_operations so apply_failed_hosts=False, isn't set like it should be ?
bauen1:
if that is actually a bug then I'll happily make an issue, I'm just not entirely sure if it's my own fault yet
fizzadar:
Hm is the fact command failing during the "preparing operations" stage? If the command executed returns a nonzero status that'll be counted as a failure, two options here: pass _ignore_errors=True to the operation/fact call or make the command "truthy" ie something like command-that-fails || true
bauen1:
Yes it is, I tried passing _ignore_errors=True to host.get_fact but that was rejected as unknown kwarg.
I'll have to test this a bit more, but I'd say this is a bug in pyinfra, I'm just not entirely sure where yet
To Reproduce
Have a fact that will error during the "Preparing Operations" stage, but not during later execution, e.g. by examining a file that will only be created during execution.
Expected behavior
A fact error should not mark the host as failed during this stage, as the fact may later succeed during actual execution.
Meta
- Include output of
pyinfra --support
.
If you are having issues with pyinfra or wish to make feature requests, please
check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
When adding an issue, be sure to include the following:
System: Linux
Platform: Linux-6.6.8-amd64-x86_64-with-glibc2.36
Release: 6.6.8-amd64
Machine: x86_64
pyinfra: v3.0b0
Executable: /usr/local/bin/pyinfra
Python: 3.11.2 (CPython, GCC 12.2.0)
- How was pyinfra installed (source/pip)?
- Include pyinfra-debug.log (if one was created)
- Consider including output with
-vv
and--debug
.