pyinfra icon indicating copy to clipboard operation
pyinfra copied to clipboard

Add "maybe" commands

Open Fizzadar opened this issue 5 years ago • 1 comments

Sometimes it is not possible to determine the remote state during the fact gathering phase, which leads to the interdependent operations issue. As a workaround pyinfra already uses quick scripts to dynamically handle such situations in some cases:

  • https://github.com/Fizzadar/pyinfra/blob/master/pyinfra/operations/init.py#L27
  • https://github.com/Fizzadar/pyinfra/blob/master/pyinfra/operations/files.py#L276

A "maybe" command would behave the same but be flagged as "might run" in the proposed changes after fact gathering. This logic could then be applied to the files.[line|directory|file] operations to remove/replace the assume_present argument, which is a far greater user experience.

There are not many operations affected by this issue anymore, and this should remove the issue entirely from the users perspective.

Fizzadar avatar Sep 01 '20 08:09 Fizzadar

Up-to-date link to interdependent operations (link in the first post is broken): https://docs.pyinfra.com/en/2.x/deploy-process.html#interdependent-operations

link2xt avatar Jul 09 '23 23:07 link2xt

v3 implements this properly "maybe will change" operations and indicated in the pre-apply changes output.

Fizzadar avatar Jun 08 '24 19:06 Fizzadar