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: reference/language-concepts/classes.markdown
+61-38Lines changed: 61 additions & 38 deletions
Original file line number
Diff line number
Diff line change
@@ -117,37 +117,64 @@ of a week.
117
117
class an error will be emitted, for example `error: You cannot cancel a
118
118
reserved hard class 'cfengine' in post-condition classes`.
119
119
120
-
* CFEngine-specific classes
121
-
*`any`: this class is always set
122
-
*`cfengine`: This class is always defined.
123
-
*`cfengine_<X>`: This class is always defined where `<X>` represents the major version of CFEngine running. For example, `cfengine_3` is defined on all versions of CFEngine 3.x.
124
-
*`cfengine_<X>_<Y>`: This class is always defined where `<X>` represents the major version of CFEngine running and `<Y>` represents the minor version. For example, `cfengine_3_24` is defined on all versions of CFEngine 3.24.x.
125
-
*`cfengine_<X>_<Y>_<Z>`: This class is always defined where `<X>` represents the major version of CFEngine running, `<Y>` represents the minor version, and `<Z>` represents the patch version. For example, `cfengine_3_24_0` is defined only on CFEngine 3.24.0.
126
-
*`am_policy_hub`, `policy_server`: set when the file
127
-
`$(workdir)/state/am_policy_hub` exists. When a host is [bootstrapped][cf-agent], if
128
-
the agent detects that it is bootstrapping to itself the file is created.
129
-
*`bootstrap_mode`: set when bootstrapping a host
130
-
*`inform_mode`, `verbose_mode`, `debug_mode`: log verbosity levels in order of noisiness
131
-
*`opt_dry_run`: set when the `--dry-run` option is given
132
-
*`failsafe_fallback`: set when the base policy is invalid and the built-in `failsafe.cf` (see `bootstrap.c`) is invoked
133
-
* (`community`, `community_edition`) and (`enterprise`, `enterprise_edition`): the two different CFEngine products, Community and Enterprise, can be distinguished by these mutually exclusive sets of hard classes
134
-
* Component Specific Classes (each component has a class that is always considered defined by that component):
135
-
*`cf-agent` :: ```agent```
136
-
*`cf-serverd` :: ```server```
137
-
*`cf-monitord` :: ```monitor```
138
-
*`cf-execd` :: ```executor```
139
-
*`cf-runagent` :: ```runagent```
140
-
*`cf-key` :: ```keygenerator```
141
-
*`cf-hub` :: ```hub```
142
-
*`cf-promises` :: ```common```
120
+
### CFEngine hard classes
121
+
122
+
Some hard classes are related to aspects of CFEngine itself, like the version and edition of CFEngine that is executing, CFEngine specific roles, options passed to the agent, features that are available.
123
+
124
+
| Class | Meaning | Example |
125
+
|```any```| This class is always defined. |`any`|
126
+
|```cfengine```| This class is always defined. |`cfengine`|
127
+
|```cfengine_<X>```| This class is always defined where `<X>` represents the major version of CFEngine running. |`cfengine_3`|
128
+
|```cfengine_<X>_<Y>```| This class is always defined where `<X>` represents the major version of CFEngine running and `<Y>` represents the minor version. |`cfengine_3_7`, `cfengine_3_24`|
129
+
|```cfengine_<X>_<Y>_<Z>```| This class is always defined where `<X>` represents the major version of CFEngine running, `<Y>` represents the minor version, and `<Z>` represents the patch version. |`cfengine_3_7_1`, `cfengine_3_24.0`|
130
+
|```<X>_edition```| This class is always defined indicating the edition of CFEngine. `*`|`enterprise_edition`, `community_edition`|
131
+
|```<edition>_<X>```| This class is always defined when using the Enterprise edition of CFEngine where `<X>` is the major version of CFEngine. |`enterprise_3`|
132
+
|```<edition>_<X>_<Y>```| This class is always defined when using the Enterprise edition of CFEngine where `<X>` is the major version and `<Y>` is the minor version of CFEngine. |`enterprise_3_7`, `enterprise_3_24`, `community_3_7`, `community_3_24`|
133
+
|```<edition>_<X>_<Y>_<Z>```| This class is always defined when using the Enterprise edition of CFEngine where `<X>` is the major, `<Y>` is the minor, and `<Z>` is the patch version of CFEngine. |`enterprise_3_7_1`, `enterprise_3_24.0`, `community_3_7_1`, `community_3_24.0`|
134
+
|```agent```| Defined when executing component is `cf-agent`. |```agent```|
135
+
|```server```| Defined when executing component is `cf-serverd`. |```server```|
136
+
|```monitor```| Defined when executing component is `cf-monitord`. |```monitor```|
137
+
|```executor```| Defined when executing component is `cf-execd`. |```executor```|
138
+
|```runagent```| Defined when executing component is `cf-runagent`. |```runagent```|
139
+
|```keygenerator```| Defined when executing component is `cf-key`. |```keygenerator```|
140
+
|```hub```| Defined when executing component is `cf-hub`. |```hub```|
141
+
|```common```| Defined when executing component is `cf-promises`. |```common```|
142
+
|```feature```| This class is always defined if the agent was compiled with at least one supported feature. |`feature`|
143
+
|```feature_<X>```| This class is always defined if the agent was compiled with feature `<X>`. |`feature_def_json_preparse`, `feature_copyfrom_restrict_keys`, `feature_host_specific_data_load`, `feature_xml`, `feature_yaml`, `feature_tls`|
144
+
|```feature_tls_<X>```| This class is always defined if the agent was compiled with support for specific major version (`<X>`) of tls. |`feature_tls_1`|
145
+
|```feature_tls_<X>_<Y>```| This class is always defined if the agent was compiled with support for specific major (`<X>`) and minor (`<Y>`) of tls. |`feature_tls_1_0`, `feature_tls_1_3`|
146
+
|```am_policy_hub```| Defined when the file `$(sys.workdir)/state/am_policy_hub** exists. `**` |`am_policy_hub`|
147
+
|```policy_server```| Defined when the file `$(sys.workdir)/state/am_policy_hub` exists. `**`|`policy_server`|
148
+
|```bootstrap_mode```| Defined when `cf-agent` is run with the `--bootstrap` option. `***`|`bootstrap_mode`|
149
+
|```inform_mode```| Defined when `cf-agent` is run with inform logging (e.g. `--log-level info`, `--inform`, `-I**). `***` |`inform_mode`|
150
+
|```verbose_mode```| Defined when `cf-agent` is run with verbose logging (e.g. `--log-level verbose`, `--verbose`, `-v`). `***`|`verbose_mode`|
151
+
|```debug_mode```| Defined when `cf-agent` is run with debug logging (e.g. `--log-level debug`, `--debug`, `-d`). `***`|`debug_mode`|
152
+
|```opt_dry_run```| Defined when `cf-agent` is run with the `--dry-run` option is given. `***`|`opt_dry_run`|
153
+
|```failsafe_fallback```| Defined when the executing policy is invalid and the built-in `failsafe.cf` (see `bootstrap.c`) is invoked. |`failsafe_fallback`|
154
+
155
+
*`*` - A class without the `_edition` suffix is also defined.
156
+
*`**` - When a host is [bootstrapped][cf-agent], if the agent detects that it is bootstrapping to itself the file `$(sys.workdir)/state/am_policy_hub** is created.
157
+
*`***` - Some, but not all options define classes when they are defined.
158
+
159
+
### Operating system hard classes
143
160
* Operating System Classes (note that the presence of these classes doesn't imply platform support)
144
161
* Operating System Architecture - `arista`, `big_ip`, `debian`, `eos`, `fedora`, `Mandrake`, `Mandriva`, `oracle`, `redhat`, `slackware`, `smartmachine`, `smartos`, `solarisx86`, `sun4`, `SuSE`, `ubuntu`, `ultrix`, the always-favorite `unknown_ostype`, etc.
145
162
* VM or hypervisor specific: `VMware`, `virt_guest_vz`, `virt_host_vz`, `virt_host_vz_vzps`, `xen`, `xen_dom0`, `xen_domu_hv`, `xen_domu_pv`, `oraclevmserver`, etc.
146
163
* On Solaris-10 systems, the zone name (in the form `zone_global, zone_foo, zone_baz`).
- The IP address octets of any active interface (in the form `ipv4_192_0_0_1`,
190
+
`ipv4_192_0_0`, `ipv4_192_0`, `ipv4_192`), provided they are not excluded by
191
+
a regular expression in the file `WORKDIR/ignore_interfaces.rx` or `WORKDIR/inputs/ignore_interfaces.rx`.
192
+
- Note: Support and preference for `WORKDIR/ignore_interfaces.rx` was added
193
+
and is present in version `3.23.0` and later and in version `3.21.4` and later.
194
+
- The names of the active interfaces (in the form
195
+
`net_iface_xl0`, `net_iface_vr0`).
196
+
197
+
### Time based hard classes
162
198
* note ALL of these have a local and a GMT version. The GMT classes are consistent the world over, in case you need global change coordination.
163
199
* Day of the Week - `Monday, Tuesday, Wednesday,...GMT_Monday, GMT_Tuesday, GMT_Wednesday,...`
164
200
* Hour of the Day in Current Time Zone - `Hr00, Hr01,... Hr23` and `Hr0, Hr1,... Hr23`
@@ -174,23 +210,10 @@ of a week.
174
210
* Lifecycle Index - `Lcycle_0, Lcycle_1, Lcycle_2` and `GMT_Lcycle_0, GMT_Lcycle_1, GMT_Lcycle_2` (the year number modulo 3, used in long term resource memory).
175
211
* **See also:** `sys.cdate`, `sys.date`.
176
212
177
-
- The unqualified name of a particular host (e.g., `www`). If
178
-
your system returns a fully qualified domain name for your host
179
-
(e.g., `www.iu.hio.no`), CFEngine will also define a hard class for
180
-
the fully qualified name, as well as the partially-qualified
181
-
component names `iu.hio.no`, `hio.no`, and `no`.
182
-
***See also:**`sys.fqhost`, `sys.uqhost`.
183
213
- An arbitrary user-defined string (as specified in the `-D`
184
214
command line option, or defined in a [`classes` promise][classes] promise or
185
215
[`classes` body][Promise types#classes],
186
216
`restart_class` in a `processes` promise, etc).
187
-
- The IP address octets of any active interface (in the form `ipv4_192_0_0_1`,
188
-
`ipv4_192_0_0`, `ipv4_192_0`, `ipv4_192`), provided they are not excluded by
189
-
a regular expression in the file `WORKDIR/ignore_interfaces.rx` or `WORKDIR/inputs/ignore_interfaces.rx`.
190
-
- Note: Support and preference for `WORKDIR/ignore_interfaces.rx` was added
191
-
and is present in version `3.23.0` and later and in version `3.21.4` and later.
192
-
- The names of the active interfaces (in the form
193
-
`net_iface_xl0`, `net_iface_vr0`).
194
217
- System status and entropy information reported by
0 commit comments