Closed sebastianelsner closed 1 year ago
Hi @sebastianelsner! Does the ./hfs19.5.403
file get created earlier on or as part of the install command? If install you could do the following:
from pyinfra.facts.files import Directory
from pyinfra.operations import server
if not host.get_fact(Directory, path="./hfs19.5.403"):
server.shell(name="Install Houdini", ...)
This best fits the two phase diff-then-apply way pyinfra works.
Ah, I see! This solves my case. Thank you!
I want an operation to run only if _precondition is "true". If it is not true, I don't want the operation to run and not produce errors. Currently, after the error the deploy stops.
The use case behind this request is to make third party software "installers" kind of "idempotent". It would be nice to separate the "precondition" from the execution of an installer.
This is the way I would do it right now:
vs. this is a "nicer" way
This way an operation would also not show up as "Changed" in the summary.
Does this request make sense?
I have been using similar functionality in Puppet with the "onlyif => ..." module directive.