pyinfra-dev / pyinfra-dev/pyinfra

Possibility to force execution of operation

Open
#653 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

API spec
Dominant language
Python
Stars
6k
Forks
548
Avg merge
7d 17h
Merged PRs (30d)
13

Description

Is your feature request related to a problem? Please describe

Pyinfra collects all facts before running operations. However sometimes an operation could modify this state during execution and as far as I could understand, there is no way to force pyinfra execute an operation.

Example:
At the end of a deploy script we want to make sure that some directory X is owned by a given user:group. In the script there is a command that could change the owner of X. Since pyinfra evaluates all the facts before starting the deployment, if the ownership was correctly set before the current deployment started (e.g. by a previous successful deployment), then the files.directory("X", user="user", group="group") will not be executed at the end of the script.

Describe the solution you'd like

A flag to make pyinfra execute an operation regardless of whether the relevant facts determined it could be skipped.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the files.directory("X", user="user", group="group") example and trace how pyinfra collects facts before deployment. Determine where an operation is skipped when facts show the desired state, and define how a force option should override that decision. Done means a forced operation executes even when its relevant facts indicate no change is needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.