You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/reference/components/_index.markdown
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,7 @@ body common control
245
245
}
246
246
```
247
247
248
-
**See also:**[`evaluation_order` in `body common control`][cf-agent#evaluation_order], [Policy style guide on promise ordering][Policy style guide#Promise ordering]
248
+
**See also:**[`evaluation_order` in `body agent control`][cf-agent#evaluation_order], [Policy style guide on promise ordering][Policy style guide#Promise ordering]
Copy file name to clipboardExpand all lines: content/reference/components/file_control_promises.markdown
+60Lines changed: 60 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,66 @@ outside of body and bundle definitions.
26
26
Only [soft classes][Classes and decisions] from common bundles can
27
27
be used in class decisions inside `file control bodies`.
28
28
29
+
### evaluation_order
30
+
31
+
**Description:**`evaluation_order` in body file control sets the evaluation order for the subsequent bundles in the file.
32
+
33
+
This setting allows you to change the order in which components execute policy within a given policy file.
34
+
By default, CFEngine uses a `classic` evaluation order, where promises are executed in a predefined order based on their type (e.g., `vars` before `files`, `files` before `packages`, etc.).
35
+
This is the historical behavior of CFEngine.
36
+
37
+
By setting `evaluation_order` to `top_down`, you can force components to evaluate promises in the order they are written in the policy file, from top to bottom.
38
+
This can make policy evaluation more familiar and possibly easier to write and understand, especially for new users, as the execution flow follows the visual layout of the code.
39
+
40
+
This attribute can also be set in `body common control` to affect all components and or `body agent control` to affect all files.
41
+
If set in multiple places, the value in `body agent control` takes precedence for `cf-agent`.
42
+
43
+
**Type:**`string`
44
+
45
+
**Allowed input range:**`(classic|top_down)`
46
+
47
+
**Default value:**`classic`
48
+
49
+
**Example:**
50
+
51
+
```cf3
52
+
body file control
53
+
{
54
+
evaluation_order => "top_down";
55
+
}
56
+
57
+
bundle agent reports_top_down
58
+
{
59
+
reports: "Hello world:";
60
+
61
+
commands: "/bin/echo hi";
62
+
63
+
reports: "bye:";
64
+
}
65
+
bundle agent __main__
66
+
{
67
+
methods: "reports_top_down";
68
+
}
69
+
70
+
body agent control
71
+
{
72
+
evaluation_order => "top_down";
73
+
}
74
+
```
75
+
76
+
Executed would result in:
77
+
78
+
```output
79
+
R: Hello world:
80
+
notice: Q: ".../bin/echo hi": hi
81
+
R: bye:
82
+
```
83
+
84
+
**See also:**[`evaluation_order` in `body agent control`](/reference/components/cf-agent/#evaluation_order),
85
+
[`evaluation_order` in `body common control`][Components#evaluation_order]
86
+
87
+
**History:** Introduced in CFEngine 3.27.0
88
+
29
89
### inputs
30
90
31
91
**Description:** The `inputs` slist contains additional filenames to parse for promises.
Copy file name to clipboardExpand all lines: content/reference/language-concepts/policy-evaluation.markdown
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,6 +33,11 @@ as early as possible in your configuration. In order to make sure all global
33
33
variables and classes are available early enough policy pre-evaluation step was
34
34
introduced.
35
35
36
+
Note: Since CFEngine 3.27.0 it's possible to configure the evaluation order from
37
+
the pre-defined normal order to the written order, top down.
38
+
39
+
**See also:**[`evaluation_order` in `body agent control`](/reference/components/cf-agent/#evaluation_order), [`evaluation_order` in `body common control`][Components#evaluation_order], [`evaluation_order` in `body file control`][file control#evaluation_order]
40
+
36
41
### Policy evaluation overview
37
42
38
43
CFEngine policy evaluation is done in several steps:
0 commit comments