Skip to content

Commit

Permalink
Added documentation for --simulate
Browse files Browse the repository at this point in the history
  • Loading branch information
nickanderson committed Nov 9, 2023
1 parent bc5f2c6 commit 8a9e5a7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
48 changes: 48 additions & 0 deletions reference/components/cf-agent.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,54 @@ affected by `common` and `agent` control bodies.

[%CFEngine_include_snippet(cf-agent.help, [\s]*--[a-z], ^$)%]

### --simulate

Like the `--dry-run` option, the `--simulate` option tries to identify changes
to your system without making changes to the system, however it goes further
than `--dry-run` by making changes in a `chroot` and making a distinction
between *safe* and *unsafe* functions, e.g. `execresult()`.

The agent will execute promises with unsafe functions when the `--simulate`
options is given only if the promise using the function is tagged `simulate_safe`.

For example:

```cf3
bundle agent __main__
{
vars:
"msg"
string => execresult( "/bin/echo Hello world!", "useshell" ),
meta => { "simulate_safe" };
}
```

The simulate option takes a parameter, `diff`, `manifest`, or `manifest-full`
which is used to determine the summary output shown at the end of the run.

* `diff` - Show only things that changed during the simulated run.
* `manifest` - Show files and packages changed by the simulated run.
* `manifest-full` - Show all files evaluated by the simulated run (including unchanged ones)

- cf-agent can now simulate the changes done to files in a chroot, printing
diff or manifest information about what it would do in a normal evaluation.
Use the new command line option: `--simulate=diff` or `--simulate=manifest`.
Please note that only files and packages promises are simulated currently.

- Added a new --simulate=manifest-full mode
New simulation mode that manifests all changed files as well as
all other files evaluated by the agent run which were not skipped
(by file selection rules) (CFE-3506)

#### Notes
* Supported on Linux for `files` and `packages` type promises

#### History
* Introduced in version 3.17.0
* `--simulate=manifest-full` introduced in version 3.18.0


## Automatic bootstrapping

Automatic bootstrapping allows the user to connect a CFEngine Host to a Policy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ This is where `body agent control` is defined. `body agent control` is where
various settings related to `cf-agent` can be tuned.

[%CFEngine_library_include(controls/cf_agent)%]

0 comments on commit 8a9e5a7

Please sign in to comment.