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-34Lines changed: 61 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -117,33 +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
-
*`am_policy_hub`, `policy_server`: set when the file
123
-
`$(workdir)/state/am_policy_hub` exists. When a host is [bootstrapped][cf-agent], if
124
-
the agent detects that it is bootstrapping to itself the file is created.
125
-
*`bootstrap_mode`: set when bootstrapping a host
126
-
*`inform_mode`, `verbose_mode`, `debug_mode`: log verbosity levels in order of noisiness
127
-
*`opt_dry_run`: set when the `--dry-run` option is given
128
-
*`failsafe_fallback`: set when the base policy is invalid and the built-in `failsafe.cf` (see `bootstrap.c`) is invoked
129
-
* (`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
130
-
* Component Specific Classes (each component has a class that is always considered defined by that component):
131
-
*`cf-agent` :: ```agent```
132
-
*`cf-serverd` :: ```server```
133
-
*`cf-monitord` :: ```monitor```
134
-
*`cf-execd` :: ```executor```
135
-
*`cf-runagent` :: ```runagent```
136
-
*`cf-key` :: ```keygenerator```
137
-
*`cf-hub` :: ```hub```
138
-
*`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
139
160
* Operating System Classes (note that the presence of these classes doesn't imply platform support)
140
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.
141
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.
142
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
158
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.
159
199
* Day of the Week - `Monday, Tuesday, Wednesday,...GMT_Monday, GMT_Tuesday, GMT_Wednesday,...`
160
200
* Hour of the Day in Current Time Zone - `Hr00, Hr01,... Hr23` and `Hr0, Hr1,... Hr23`
@@ -170,23 +210,10 @@ of a week.
170
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).
171
211
* **See also:** `sys.cdate`, `sys.date`.
172
212
173
-
- The unqualified name of a particular host (e.g., `www`). If
174
-
your system returns a fully qualified domain name for your host
175
-
(e.g., `www.iu.hio.no`), CFEngine will also define a hard class for
176
-
the fully qualified name, as well as the partially-qualified
177
-
component names `iu.hio.no`, `hio.no`, and `no`.
178
-
***See also:**`sys.fqhost`, `sys.uqhost`.
179
213
- An arbitrary user-defined string (as specified in the `-D`
180
214
command line option, or defined in a [`classes` promise][classes] promise or
181
215
[`classes` body][Promise types#classes],
182
216
`restart_class` in a `processes` promise, etc).
183
-
- The IP address octets of any active interface (in the form `ipv4_192_0_0_1`,
184
-
`ipv4_192_0_0`, `ipv4_192_0`, `ipv4_192`), provided they are not excluded by
185
-
a regular expression in the file `WORKDIR/ignore_interfaces.rx` or `WORKDIR/inputs/ignore_interfaces.rx`.
186
-
- Note: Support and preference for `WORKDIR/ignore_interfaces.rx` was added
187
-
and is present in version `3.23.0` and later and in version `3.21.4` and later.
188
-
- The names of the active interfaces (in the form
189
-
`net_iface_xl0`, `net_iface_vr0`).
190
217
- System status and entropy information reported by
0 commit comments