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

Fact errors during "Preparing Operations" mark host as failed even if fact will later succeed #1104

Open
bauen1 opened this issue May 14, 2024 · 0 comments
Labels
Bug Label for all kind of bugs.

Comments

@bauen1
Copy link
Contributor

bauen1 commented May 14, 2024

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.
@bauen1 bauen1 added the Bug Label for all kind of bugs. label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Label for all kind of bugs.
Projects
None yet
Development

No branches or pull requests

1 participant