From 36b556e58a43929fd64ecfcee02e883beee3a9be Mon Sep 17 00:00:00 2001 From: Bastian Triller Date: Fri, 12 Sep 2025 10:39:39 +0200 Subject: [PATCH 1/2] promise-types/classes: Include common attributes (cherry picked from commit 8da07a9c3e4dee5b65ff32a45b8781c2202bacc2) --- reference/promise-types/classes.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/reference/promise-types/classes.markdown b/reference/promise-types/classes.markdown index eb7091f14..03a2308ed 100644 --- a/reference/promise-types/classes.markdown +++ b/reference/promise-types/classes.markdown @@ -75,6 +75,8 @@ bundle agent example ## Attributes ## +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + ### and **Description:** Combine class sources with AND From 4b9728f73b5af6b719def694db86366a47b3aed8 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Fri, 26 Sep 2025 09:15:15 -0500 Subject: [PATCH 2/2] Added more missing common attributes (cherry picked from commit bcf14a058016d3d7a6271e17ffdf4f6ce1726bf2) --- reference/common-attributes-include.markdown | 2 + reference/promise-types/access.markdown | 2 + reference/promise-types/defaults.markdown | 2 + reference/promise-types/measurements.markdown | 2 + reference/promise-types/meta.markdown | 87 +++++++++++++++++++ reference/promise-types/roles.markdown | 2 + reference/promise-types/vars.markdown | 2 + 7 files changed, 99 insertions(+) diff --git a/reference/common-attributes-include.markdown b/reference/common-attributes-include.markdown index 712a72f79..309623820 100644 --- a/reference/common-attributes-include.markdown +++ b/reference/common-attributes-include.markdown @@ -16,6 +16,8 @@ the [Promise types] page. The common attributes are as follows: #### [if][Promise types#if] +#### [unless][Promise types#unless] + #### [meta][Promise types#meta] #### [with][Promise types#with] diff --git a/reference/promise-types/access.markdown b/reference/promise-types/access.markdown index 4130a7b89..21b839221 100644 --- a/reference/promise-types/access.markdown +++ b/reference/promise-types/access.markdown @@ -117,6 +117,8 @@ promises will override less specific ones. ## Attributes ## +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + ### admit_hostnames **Description:** A list of hostnames or domains that should have access to the object. diff --git a/reference/promise-types/defaults.markdown b/reference/promise-types/defaults.markdown index 51b17a317..fac138f64 100644 --- a/reference/promise-types/defaults.markdown +++ b/reference/promise-types/defaults.markdown @@ -89,6 +89,8 @@ reports: ## Attributes ## +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + ### if_match_regex **Description:** If this [anchored][anchored] regular expression matches the diff --git a/reference/promise-types/measurements.markdown b/reference/promise-types/measurements.markdown index e34ab4b3e..4df1f67f2 100644 --- a/reference/promise-types/measurements.markdown +++ b/reference/promise-types/measurements.markdown @@ -153,6 +153,8 @@ may be used in other promises in the form `$(mon.handle)`. ## Attributes ## +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + ### stream_type **Description:** The datatype being collected. diff --git a/reference/promise-types/meta.markdown b/reference/promise-types/meta.markdown index 09e639164..48dabae08 100644 --- a/reference/promise-types/meta.markdown +++ b/reference/promise-types/meta.markdown @@ -27,3 +27,90 @@ reports: ``` The value of meta data can be of the types `string` or `slist` or `data`. + +## Attributes + +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + +### data + +**Description:** A data container structure + +**Type:** `data` + +**Allowed input range:** (arbitrary string) + +**Example:** + +```cf3 +vars: + + "loaded1" data => readjson("/tmp/myfile.json", 40000); + "loaded2" data => parsejson('{"key":"value"}'); + "loaded3" data => readyaml("/tmp/myfile.yaml", 40000); + "loaded4" data => parseyaml('- key2: value2'); + "merged1" data => mergedata(loaded1, loaded2, loaded3, loaded4); + + # JSON or YAML can be inlined since CFEngine 3.7 + "inline1" data => '{"key":"value"}'; # JSON + "inline2" data => '---$(const.n)- key2: value2'; # YAML requires "---$(const.n)" header +``` + +### slist + +**Description:** A list of scalar strings + +**Type:** `slist` + +**Allowed input range:** (arbitrary string) + +**Example:** + +```cf3 +vars: + + "xxx" slist => { "literal1", "literal2" }; + "xxx1" slist => { "1", @(xxx) }; # interpolated in order + "yyy" slist => { + readstringlist( + "/home/mark/tmp/testlist", + "#[a-zA-Z0-9 ]*", + "[^a-zA-Z0-9]", + 15, + 4000 + ) + }; + + "zzz" slist => { readstringlist( + "/home/mark/tmp/testlist2", + "#[^\n]*", + ",", + 5, + 4000) + }; +``` + +**Notes:** + +Some [functions][Functions] return `slist`s, and an `slist` +may contain the values copied from another `slist`, `rlist`, or `ilist`. See +[`policy`](#policy). + + +### string + +**Description:** A scalar string + +**Type:** `string` + +**Allowed input range:** (arbitrary string) + +**Example:** + +```cf3 +vars: + + "xxx" string => "Some literal string..."; + "yyy" string => readfile( "/home/mark/tmp/testfile" , "33" ); +``` + diff --git a/reference/promise-types/roles.markdown b/reference/promise-types/roles.markdown index ee1396b97..e2667f9b3 100644 --- a/reference/promise-types/roles.markdown +++ b/reference/promise-types/roles.markdown @@ -43,6 +43,8 @@ classes matching the regular expression `Myclass_.*` when using the ## Attributes ## +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + ### authorize **Description:** List of public-key user names that are allowed to activate diff --git a/reference/promise-types/vars.markdown b/reference/promise-types/vars.markdown index e000dc323..bb42be062 100644 --- a/reference/promise-types/vars.markdown +++ b/reference/promise-types/vars.markdown @@ -303,6 +303,8 @@ vars: ## Attributes ## +{{< CFEngine_include_markdown(common-attributes.include.markdown) >}} + ### policy **Description:** The policy for (dis)allowing (re)definition of variables