diff --git a/.github/workflows/markdowner.yml b/.github/workflows/formatting.yml similarity index 67% rename from .github/workflows/markdowner.yml rename to .github/workflows/formatting.yml index 7d6df349f..542ce49c0 100644 --- a/.github/workflows/markdowner.yml +++ b/.github/workflows/formatting.yml @@ -1,4 +1,4 @@ -name: Run markdowner.py on all markdown files and see if there are changes +name: Check formatting on: push: @@ -19,9 +19,12 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.12" - - name: Run markdowner.py to (hopefully not) edit markdown files + - name: Install CFEngine CLI run: | - find . -name '*.markdown' -type f -exec python3 .github/workflows/markdowner.py {} all \; | tee output.log + pipx install cfengine + - name: Run formatting command to (hopefully not) make changes + run: | + cfengine dev docs-format - name: Check output.log file for warnings run: | ! grep WARNING output.log diff --git a/.github/workflows/markdowner.py b/.github/workflows/markdowner.py deleted file mode 100644 index c5d80e49e..000000000 --- a/.github/workflows/markdowner.py +++ /dev/null @@ -1,245 +0,0 @@ -#!/usr/bin/env python3 -# To run this on all markdown files do: -# find . -name '*.markdown' -type f -exec python3 .github/workflows/markdowner.py {} all \; | tee output.log - -import sys -import re -from collections import defaultdict - - -class EasyDict(defaultdict): - def __getattr__(self, key): - return self[key] - - def __setattr__(self, key, value): - self[key] = value - return value - - def set_flag_list(self, l): - for x in l: - self.__setattr__(x, True) - - -def replace_with_dict(content, replacements, filename): - for k, v in replacements.items(): - while k in content: - print(f"{filename}: {repr(k)} -> {repr(v)}") - content = content.replace(k, v) - return content - - -def replace_with_regex_dict(content, replacements, filename): - for str_pattern, replacement in replacements.items(): - pattern = re.compile(str_pattern, flags=re.MULTILINE) - while True: - match = pattern.search(content) - if not match: - break - start, end = match.span() - match = match.group(0) - print(f"{filename}: {repr(match)} -> {repr(replacement)}") - content = content[0:start] + replacement + content[end:] - return content - - -def process_codeblock(lines, filename, lineno_start): - result = [] - begin = lines[0] - end = lines[-1] - lines = lines[1:-1] # Lines inside code block - - prefix = begin[0 : begin.index("```")] - lang = begin[len(prefix) + 3 :].strip() - - # Checks for warnings which make us leave the code block alone: - - if not end == (prefix + "```"): - lineno = lineno_start + len(lines) + 1 - print(f"WARNING {filename}:{lineno}: End backticks not matching beginning") - return [begin, *lines, end] - - lineno = lineno_start - for i, line in enumerate(lines): - # Empty lines are already correct, skip them: - if line == "": - lineno += 1 - continue - if not line.startswith(prefix): - print(f"WARNING {filename}:{lineno}: Code block indentation inconsistent") - return [begin, *lines, end] - # Should already be fixed if using the trailing whitespace removal: - if line == prefix or line.strip() == "": - print(f"WARNING {filename}:{lineno}: Code block has whitespace-only lines") - return [begin, *lines, end] - lineno += 1 - - # Find the common indentation which we would like to remove: - common_indent = None - lineno = lineno_start - for i, line in enumerate(lines): - # Don't consider empty lines for common indentation: - if line == "": - lineno += 1 - continue - if line[len(prefix) :][0] != " ": - # Found content without extra indentation - - # no common indentation to remove. - common_indent = None - break - index = len(prefix) - spaces = 0 - while True: - c = line[index] - if c != " ": - break - spaces += 1 - index += 1 - if index >= len(line): - break - if common_indent is None or spaces < common_indent: - common_indent = spaces - lineno += 1 - - # Remove common indent if found: - if common_indent is not None and common_indent > 0: - spaces = common_indent - lines = [ - x if x == "" else x[0 : len(prefix)] + x[len(prefix) + spaces :] - for x in lines - ] - print( - f"{filename}:{lineno_start}: De-indented {lang + ' ' if lang else ''}code block" - ) - - # Remove empty lines at beginning and end: - while lines and lines[0] == "": - lines = lines[1:] - print( - f"{filename}:{lineno_start}: Removed empty line at beginning of {lang + ' ' if lang else ''} code block" - ) - while lines and lines[-1] == "": - lines = lines[0:-1] - print( - f"{filename}:{lineno_start}: Removed empty line at beginning of {lang + ' ' if lang else ''} code block" - ) - - # "Render" result - May or may not be different - result.append(begin) - result.extend(lines) - result.append(end) - return result - - -def edit_codeblocks(content, filename): - done = [] - to_do = [] - state = "outside" - lineno = 0 - lineno_start = None - will_try = False - - for line in content.split("\n"): - lineno += 1 - if state == "outside": - count = len(line.split("```")) - 1 - if count == 0: - done.append(line) - elif count == 1 and line.strip().startswith("```"): - to_do.append(line) - state = "inside" - lineno_start = lineno - will_try = True - elif count % 2 != 0: - print( - f"WARNING {filename}:{lineno}: Start of code block not on start of line" - ) - done.append(line) - will_try = False - state = "inside" - else: - done.append(line) - else: - assert state == "inside" - if will_try: - to_do.append(line) - else: - done.append(line) - if line.strip().startswith("```"): - if to_do: - done.extend(process_codeblock(to_do, filename, lineno_start)) - to_do = [] - state = "outside" - elif "```" in line: - print( - f"WARNING {filename}:{lineno}: End of code block not on start of line" - ) - will_try = False - done.extend(to_do) - to_do = [] - - count = len(line.split("```")) - 1 - if count % 2 == 1: - state = "outside" - - done.extend(to_do) - content = "\n".join(done) - return content - - -def perform_edits(content, flags, filename): - if flags.trailing or flags.all: - replacements = {" \n": "\n", "\t\n": "\n"} - content = replace_with_dict(content, replacements, filename) - - if flags.ascii or flags.all: - replacements = {"‘": "'", "’": "'", "“": '"', "”": '"', "–": "-"} - content = replace_with_dict(content, replacements, filename) - - if flags.eof or flags.all: - while content.endswith("\n\n"): - content = content[:-1] - print(f"{filename}: Removed excess newlines before EOF") - if not content.endswith("\n"): - content = content + "\n" - print(f"{filename}: Added newline before EOF") - - if flags.codeblocks or flags.all: - content = replace_with_regex_dict(content, replacements, filename) - replacements = { - # Empty line (double newline) before command: - r"(?"}` after the language specifier (i.e. on the end of the same line as the triple backticks and `cf3`). +This metadata won't be shown in the resulting HTML (it will be converted to the heading / frame). ```cf3 {file="policy.cf"} bundle agent hello_world @@ -418,9 +407,7 @@ index 92555a2..b49c0bb 100644 ```json { - "classes": { - "services_autorun": ["any"] - } + "classes": { "services_autorun": ["any"] } } ``` @@ -428,9 +415,7 @@ index 92555a2..b49c0bb 100644 ```json { - "classes": { - "services_autorun": ["any"] - } + "classes": { "services_autorun": ["any"] } } ``` diff --git a/content/api/enterprise-api-examples/browsing-host-information.markdown b/content/api/enterprise-api-examples/browsing-host-information.markdown index 92d07ddec..decbfaeac 100644 --- a/content/api/enterprise-api-examples/browsing-host-information.markdown +++ b/content/api/enterprise-api-examples/browsing-host-information.markdown @@ -9,7 +9,6 @@ information. For full flexibility we recommend using [SQL][SQL schema] reports via [/api/query][Query REST API#Execute SQL query] for this. however, currently vital signs (data gathered from `cf-monitord`) is not part of the SQL reports data model. - ## Example: Listing hosts with a given context **Request** @@ -71,7 +70,6 @@ for presentability). ] } - #### Example: Looking up hosts by IP Similarly we can lookup the host with hostname @@ -101,7 +99,6 @@ for presentability). ] } - ## Example: Removing host data If a host has been decommissioned from a Hub, we can explicitly remove data diff --git a/content/api/enterprise-api-examples/managing-settings.markdown b/content/api/enterprise-api-examples/managing-settings.markdown index e1d657627..c7bd69aaa 100644 --- a/content/api/enterprise-api-examples/managing-settings.markdown +++ b/content/api/enterprise-api-examples/managing-settings.markdown @@ -46,7 +46,6 @@ are managed by the LDAP API and not this Settings API. 204 No Content - ## Example: Changing the log level The API uses standard Unix syslog to log a number of events. Additionally, log diff --git a/content/api/enterprise-api-examples/managing-users-and-roles.markdown b/content/api/enterprise-api-examples/managing-users-and-roles.markdown index 04c446df8..f29bf8c65 100644 --- a/content/api/enterprise-api-examples/managing-users-and-roles.markdown +++ b/content/api/enterprise-api-examples/managing-users-and-roles.markdown @@ -8,7 +8,6 @@ Users and Roles determine who has access to what data from the API. Roles are defined by regular expressions that determine which hosts the user can see, and what policy outcomes are restricted. - ## Example: Listing users **Request** @@ -44,7 +43,6 @@ user can see, and what policy outcomes are restricted. ] } - ## Example: Creating a new user All users will be created for the internal user table. The API will never @@ -65,7 +63,6 @@ attempt to write to an external LDAP server. 201 Created } - ## Example: Updating an existing user Both internal and external users may be updated. When updating an external @@ -135,7 +132,6 @@ is used to remove a user from a role. 204 No Content } - ## Example: Deleting a user Users can only be deleted from the internal users table. diff --git a/content/api/enterprise-api-ref/_index.markdown b/content/api/enterprise-api-ref/_index.markdown index 565bb4dae..675ba318b 100644 --- a/content/api/enterprise-api-ref/_index.markdown +++ b/content/api/enterprise-api-ref/_index.markdown @@ -86,7 +86,6 @@ table will always be consulted first, followed by an external source specified in the settings. External sources are *OpenLDAP* or *Active Directory* servers configurable through [/api/settings][Status and settings REST API#Update settings]. - ## Authorization Some resources require that the request user is a member of the *admin* role. Roles are managed with [/api/role][Users and access-control REST API#List RBAC roles]. Role Based Access Control (RBAC) is configurable through the settings. Users typically have permission to access their own resources, e.g. their own scheduled reports. diff --git a/content/api/enterprise-api-ref/audit-logs-api.markdown b/content/api/enterprise-api-ref/audit-logs-api.markdown index 739d99b00..808d077e3 100644 --- a/content/api/enterprise-api-ref/audit-logs-api.markdown +++ b/content/api/enterprise-api-ref/audit-logs-api.markdown @@ -121,7 +121,6 @@ HTTP 200 OK | 403 Insufficient permissions | Audit logs are not available to user | | 500 Internal server error | Internal server error | - ### Allowed actions | Action | Description | @@ -152,7 +151,6 @@ HTTP 200 OK | Host | Host configuration | | Build project | Build project configuration | - ## Get audit logs actors Returns list of users who performed actions. diff --git a/content/api/enterprise-api-ref/build-api.markdown b/content/api/enterprise-api-ref/build-api.markdown index 329a30b25..768e1cdca 100644 --- a/content/api/enterprise-api-ref/build-api.markdown +++ b/content/api/enterprise-api-ref/build-api.markdown @@ -863,7 +863,6 @@ HTTP 200 OK | 404 Not found | Module not found | | 500 Internal server error | Internal server error | - ### Get CFEngine Build module input data **URI:** https://hub.cfengine.com/api/build/projects/:id/modules/:name/input @@ -941,7 +940,6 @@ HTTP 200 OK | 404 Not found | Project or module not found | | 500 Internal server error | Internal server error | - ### Set CFEngine Build module input data **URI:** https://hub.cfengine.com/api/build/projects/:id/modules/:name/input diff --git a/content/api/enterprise-api-ref/cmdb-api.markdown b/content/api/enterprise-api-ref/cmdb-api.markdown index 1be7842d5..af14b9488 100644 --- a/content/api/enterprise-api-ref/cmdb-api.markdown +++ b/content/api/enterprise-api-ref/cmdb-api.markdown @@ -34,7 +34,6 @@ You can see a list of stored host-specific configurations * **hostContextExclude** *(array)* Excludes results that concern hosts which have specified CFEngine context (class) set. Hosts that have at least one of the specified contexts set will be excluded from the results. Optional parameter. - **Example request (curl):** ```console @@ -213,7 +212,6 @@ curl -k --user : \ HTTP 200 Ok ``` - ## Batch create configurations **URI:** https://hub.cfengine.com/api/cmdb @@ -231,13 +229,13 @@ HTTP 200 Ok ```json { - "classes":{ - "My_class": {}, - "My_class2": { - "comment":"comment body", - "tags": ["suggestion-001", "reporting"] - } - } + "classes": { + "My_class": {}, + "My_class2": { + "comment": "comment body", + "tags": ["suggestion-001", "reporting"] + } + } } ``` @@ -248,20 +246,17 @@ HTTP 200 Ok ```json { - "variables":{ - "Namespace:BundleName.VariableName":{ - "value":"myvalue" - }, - "HubCMDB:My.hostname":{ - "value":"host1.cfengine.com", - "comment":"My hostname should be set to this", - "tags": ["suggestion-001", "reporting"] - } - } + "variables": { + "Namespace:BundleName.VariableName": { "value": "myvalue" }, + "HubCMDB:My.hostname": { + "value": "host1.cfengine.com", + "comment": "My hostname should be set to this", + "tags": ["suggestion-001", "reporting"] + } + } } ``` - **Example request (curl):** ```console @@ -346,7 +341,6 @@ curl -k --user : \ HTTP 200 Ok ``` - ## Batch update configurations **URI:** https://hub.cfengine.com/api/cmdb/:hostkey @@ -364,14 +358,7 @@ HTTP 200 Ok ```json { - "classes":{ - "My_class":{ - - }, - "My_class2":{ - "comment":"comment body" - } - } + "classes": { "My_class": {}, "My_class2": {"comment": "comment body"} } } ``` @@ -379,7 +366,7 @@ If you need to delete all classes from host you need to set null value: ```json { - "classes": null + "classes": null } ``` @@ -392,15 +379,13 @@ If your request body misses classes then the previous value will be preserved. ```json { - "variables":{ - "Namespace:BundleName.VariableName":{ - "value":"myvalue" - }, - "HubCMDB:My.hostname":{ - "value":"host1.cfengine.com", - "comment":"My hostname should be set to this" - } - } + "variables": { + "Namespace:BundleName.VariableName": { "value": "myvalue" }, + "HubCMDB:My.hostname": { + "value": "host1.cfengine.com", + "comment": "My hostname should be set to this" + } + } } ``` @@ -408,7 +393,7 @@ If you need to delete all variables from host you need to set null value: ```json { - "variables": null + "variables": null } ``` If your request body misses variables then the previous value will be preserved. @@ -487,7 +472,6 @@ HTTP 204 No Content * **name** *(string)* Configuration name. Classes or variables name. - **Example request (curl):** ```console diff --git a/content/api/enterprise-api-ref/export-import-api.markdown b/content/api/enterprise-api-ref/export-import-api.markdown index 24ce0e75c..e9fefbbbe 100644 --- a/content/api/enterprise-api-ref/export-import-api.markdown +++ b/content/api/enterprise-api-ref/export-import-api.markdown @@ -78,7 +78,6 @@ HTTP 200 Ok * **name** Name of export item. - ## Export **URI:** https://hub.example/data_transfer/api/export @@ -132,7 +131,6 @@ HTTP 200 Ok * **file_name** *(string)* File name to be downloaded. - **Example request (curl):** ``` @@ -159,7 +157,6 @@ Raw file contetnt * Content-Length: 337801 * Content-Type: application/octet-stream - ## Analyze import file This API call allows you to see short summary of file content. diff --git a/content/api/enterprise-api-ref/export-import-compliance-report-api.markdown b/content/api/enterprise-api-ref/export-import-compliance-report-api.markdown index 1f8bbcb9a..26b4d3dfe 100644 --- a/content/api/enterprise-api-ref/export-import-compliance-report-api.markdown +++ b/content/api/enterprise-api-ref/export-import-compliance-report-api.markdown @@ -71,7 +71,6 @@ HTTP 200 Ok } ``` - ## Import **URI:** https://hub.example/advancedreports/complianceReport/import @@ -146,7 +145,6 @@ HTTP 200 Ok * **host_filter** *(text)* Host filter, should be valid class expression. - * **overwrite** *(booleans)* Set true to overwrite existing reports or conditions that belong to you. Default: false diff --git a/content/api/enterprise-api-ref/federated-reporting-api.markdown b/content/api/enterprise-api-ref/federated-reporting-api.markdown index a8ae8ad56..96c28654c 100644 --- a/content/api/enterprise-api-ref/federated-reporting-api.markdown +++ b/content/api/enterprise-api-ref/federated-reporting-api.markdown @@ -169,7 +169,6 @@ HTTP 202 ACCEPTED HTTP 202 ACCEPTED ``` - ### Enable hub as a feeder **URI:** https://hub.cfengine.com/api/fr/setup-hub/feeder diff --git a/content/api/enterprise-api-ref/file-changes.markdown b/content/api/enterprise-api-ref/file-changes.markdown index d9e51f19d..f87bb7c8b 100644 --- a/content/api/enterprise-api-ref/file-changes.markdown +++ b/content/api/enterprise-api-ref/file-changes.markdown @@ -3,7 +3,6 @@ layout: default title: File changes API --- - ## File changes statistics **URI:** https://hub.cfengine.com/api/file-changes/statistics?fromTime=:fromTime&toTime=:toTime diff --git a/content/api/enterprise-api-ref/health-diagnostic.markdown b/content/api/enterprise-api-ref/health-diagnostic.markdown index e4e3a0271..7aa2b9e14 100644 --- a/content/api/enterprise-api-ref/health-diagnostic.markdown +++ b/content/api/enterprise-api-ref/health-diagnostic.markdown @@ -150,7 +150,6 @@ curl -k --user : -X POST \ * **limit** *(integer)* Limit the number of results in the query. - **CURL Request Example:** ``` curl -k --user : -X GET \ @@ -236,7 +235,6 @@ curl -k --user : -X GET \ * **hosts** *(array)* Array of host keys to dismiss - **CURL Request Example:** ``` curl -k --user admin:admin -X POST \ @@ -251,7 +249,6 @@ curl -k --user admin:admin -X POST \ HTTP 201 CREATED ``` - ## Remove hosts from dismissed list **URI:** https://hub.cfengine.com/api/health-diagnostic/dismiss/:report_id @@ -266,7 +263,6 @@ HTTP 201 CREATED * **hosts** *(array)* Array of host keys to remove from dismissed list - **CURL Request Example:** ``` curl -k --user admin:admin -X POST \ diff --git a/content/api/enterprise-api-ref/host.markdown b/content/api/enterprise-api-ref/host.markdown index 425cef8f7..01c4357a8 100644 --- a/content/api/enterprise-api-ref/host.markdown +++ b/content/api/enterprise-api-ref/host.markdown @@ -475,7 +475,6 @@ Note: Collecting monitoring data by default is disabled. **Example usage:** `Example: Retrieving vital sign data` - ## Get count of bootstrapped hosts by date range **URI:** https://hub.cfengine.com/api/host-count diff --git a/content/api/enterprise-api-ref/inventory.markdown b/content/api/enterprise-api-ref/inventory.markdown index 2008d1b1a..8c2332262 100644 --- a/content/api/enterprise-api-ref/inventory.markdown +++ b/content/api/enterprise-api-ref/inventory.markdown @@ -6,12 +6,10 @@ Inventory API allows to access inventory reports and attributes dictionary. ## Inventory reports - **URI:** https://hub.cfengine.com/api/inventory **Method:** POST - **Parameters:** * **select** *(array)* @@ -54,7 +52,6 @@ Inventory API allows to access inventory reports and attributes dictionary. | is_reported | | is_not_reported | - * **sort** *(string)* Field name for sorting with "-" for DESC order. Optional parameter. * **start** *(integer)* @@ -107,7 +104,6 @@ curl -k --user : \ **Example Request Body:** - ``` { "sort":"Host name", @@ -132,7 +128,6 @@ curl -k --user : \ **Example response:** - ``` { "data": [ @@ -190,7 +185,6 @@ curl -k --user : \ **Example Request Body with includeAdditionally set to true:** - ``` { "sort": "Host name", @@ -218,7 +212,6 @@ curl -k --user : \ **Example response:** - As you can see, despite the OS filter should return zero hosts, we had one additionally included by the host in the Host filter. ``` @@ -272,7 +265,6 @@ curl -k --user admin:admin -X GET https://hub.cfengine.com/api/inventory/attribu **Example response:** - ``` [ { @@ -317,7 +309,6 @@ Only `readonly - 0` attribute can be edited Convert Function. Emp.: `cf_clearSlist` - to transform string like `{"1", "2"}` to `1, 2` - **CURL request example** ``` curl -k --user admin:admin -X PATCH https://hub.cfengine.com/api/inventory/attributes-dictionary/260 -H 'content-type: application/json' -d '{ diff --git a/content/api/enterprise-api-ref/personal-groups.markdown b/content/api/enterprise-api-ref/personal-groups.markdown index 992552143..dbe64e8d1 100644 --- a/content/api/enterprise-api-ref/personal-groups.markdown +++ b/content/api/enterprise-api-ref/personal-groups.markdown @@ -41,42 +41,28 @@ The personal groups API enables creating host groups based on host filters (the ```json { "filter": { - "filter":{ - "Attribute name": { - "operator":"value2" - } - }, + "filter": { "Attribute name": {"operator": "value2"} }, "hostFilter": { - "includes": { - "includeAdditionally": false, - "entries": { - "ip": [ - "192.168.56.5" - ], - "hostkey": [], - "hostname": [ - "ubuntu-bionic" - ], - "mac": [ - "08:00:27:0b:a4:99", - "08:00:27:dd:e1:59", - "02:9f:d3:59:7e:90" - ], - "ip_mask": [ - "10.0.2.16/16" - ] - } - }, - "excludes": { - "entries":{ - "ip": [], - "hostkey": [], - "hostname": [], - "mac": [], - "ip_mask": [] - } - } + "includes": { + "includeAdditionally": false, + "entries": { + "ip": ["192.168.56.5"], + "hostkey": [], + "hostname": ["ubuntu-bionic"], + "mac": ["08:00:27:0b:a4:99", "08:00:27:dd:e1:59", "02:9f:d3:59:7e:90"], + "ip_mask": ["10.0.2.16/16"] + } }, + "excludes": { + "entries": { + "ip": [], + "hostkey": [], + "hostname": [], + "mac": [], + "ip_mask": [] + } + } + }, "hostContextExclude": ["class_value"], "hostContextInclude": ["class_value"] } @@ -104,7 +90,6 @@ For filtering you can use the operators below: | is_reported | | is_not_reported | - ``` curl -k --user : \ -X POST \ @@ -157,11 +142,12 @@ curl -k --user : \ }' ``` - **Example response:** ```json -{"id":"4"} +{ + "id": "4" +} ``` ## Update group @@ -203,45 +189,30 @@ curl -k --user : \ ```json { "filter": { - "filter":{ - "Attribute name": { - "operator":"value2" - } + "filter": { "Attribute name": {"operator": "value2"} }, + "hostFilter": { + "includes": { + "includeAdditionally": false, + "ip": ["192.168.56.5"], + "hostkey": [], + "hostname": ["ubuntu-bionic"], + "mac": ["08:00:27:0b:a4:99", "08:00:27:dd:e1:59", "02:9f:d3:59:7e:90"], + "ip_mask": ["10.0.2.16/16"] }, - "hostFilter": { - "includes": { - "includeAdditionally": false, - "ip": [ - "192.168.56.5" - ], - "hostkey": [], - "hostname": [ - "ubuntu-bionic" - ], - "mac": [ - "08:00:27:0b:a4:99", - "08:00:27:dd:e1:59", - "02:9f:d3:59:7e:90" - ], - "ip_mask": [ - "10.0.2.16/16" - ] - }, - "excludes": { - "ip": [], - "hostkey": [], - "hostname": [], - "mac": [], - "ip_mask": [] - } - }, - "hostContextExclude": ["class_value"], - "hostContextInclude": ["class_value"] + "excludes": { + "ip": [], + "hostkey": [], + "hostname": [], + "mac": [], + "ip_mask": [] + } + }, + "hostContextExclude": ["class_value"], + "hostContextInclude": ["class_value"] } } ``` - **Operators:** For filtering you can use the operators below: @@ -263,7 +234,6 @@ For filtering you can use the operators below: | is_reported | | is_not_reported | - **Example request:** ``` @@ -287,11 +257,12 @@ curl -k --user : \ }' ``` - **Example response:** ```json -{"id":"4"} +{ + "id": "4" +} ``` ## Get group @@ -318,27 +289,20 @@ curl -k --user : \ ```json { - "id": 4, - "name": "AIX hosts", - "description": "Host name", - "owner": "admin", - "creation_time": "2023-06-14 10:41:25.601112+00", - "filter": { - "filter": { - "Architecture": { - "matches": "86" - } - }, - "hostContextExclude": "", - "hostContextInclude": [ - "aix" - ] - }, - "type": "personal" + "id": 4, + "name": "AIX hosts", + "description": "Host name", + "owner": "admin", + "creation_time": "2023-06-14 10:41:25.601112+00", + "filter": { + "filter": { "Architecture": {"matches": "86"} }, + "hostContextExclude": "", + "hostContextInclude": ["aix"] + }, + "type": "personal" } ``` - ## Remove group **URI:** https://hub.cfengine.com/api/host-groups/personal/:id @@ -359,7 +323,6 @@ curl -k --user : \ -H 'content-type: application/json' ``` - ## Groups list **URI:** https://hub.cfengine.com/api/host-groups/personal @@ -395,15 +358,9 @@ curl -k --user : \ "owner": "admin", "creation_time": "2023-06-14 10:41:25.601112+00", "filter": { - "filter": { - "Architecture": { - "matches": "86" - } - }, + "filter": { "Architecture": {"matches": "86"} }, "hostContextExclude": "", - "hostContextInclude": [ - "aix" - ] + "hostContextInclude": ["aix"] } } ], @@ -417,7 +374,6 @@ curl -k --user : \ } ``` - ## Share personal group **URI:** https://hub.cfengine.com/api/host-groups/personal/:id/share @@ -442,5 +398,7 @@ curl -k --user : \ API returns new ID of the shared group. ```json -{"id":"5"} +{ + "id": "5" +} ``` diff --git a/content/api/enterprise-api-ref/reset-password.markdown b/content/api/enterprise-api-ref/reset-password.markdown index 8742c876d..f17e9746a 100644 --- a/content/api/enterprise-api-ref/reset-password.markdown +++ b/content/api/enterprise-api-ref/reset-password.markdown @@ -36,7 +36,6 @@ Reset password email successfully sent. | 200 OK | Check your email for the link to reset your password. | | 422 Unprocessable Entity | We are unable to reset the password at this time. | - ## Reset password by token This call provides possibility to change password by reset password token @@ -70,7 +69,6 @@ Reset password email successfully sent. | 422 Unprocessable Entity | Password validation error or the request cannot be processed. | | 429 Too Many Requests | We have detected multiple unsuccessful reset password attempts. | - ## Invalidate reset password token This call provides possibility to invalidate reset password token diff --git a/content/api/enterprise-api-ref/shared-groups.markdown b/content/api/enterprise-api-ref/shared-groups.markdown index e7a9062a3..943703350 100644 --- a/content/api/enterprise-api-ref/shared-groups.markdown +++ b/content/api/enterprise-api-ref/shared-groups.markdown @@ -44,49 +44,34 @@ The shared groups API enables creating host groups based on host filters (the sa ```json { "filter": { - "filter":{ - "Attribute name": { - "operator":"value2" - } - }, + "filter": { "Attribute name": {"operator": "value2"} }, "hostFilter": { - "includes": { - "includeAdditionally": false, - "entries": { - "ip": [ - "192.168.56.5" - ], - "hostkey": [], - "hostname": [ - "ubuntu-bionic" - ], - "mac": [ - "08:00:27:0b:a4:99", - "08:00:27:dd:e1:59", - "02:9f:d3:59:7e:90" - ], - "ip_mask": [ - "10.0.2.16/16" - ] - } - }, - "excludes": { - "entries":{ - "ip": [], - "hostkey": [], - "hostname": [], - "mac": [], - "ip_mask": [] - } - } + "includes": { + "includeAdditionally": false, + "entries": { + "ip": ["192.168.56.5"], + "hostkey": [], + "hostname": ["ubuntu-bionic"], + "mac": ["08:00:27:0b:a4:99", "08:00:27:dd:e1:59", "02:9f:d3:59:7e:90"], + "ip_mask": ["10.0.2.16/16"] + } }, - "hostContextExclude": ["class_value"], - "hostContextInclude": ["class_value"] + "excludes": { + "entries": { + "ip": [], + "hostkey": [], + "hostname": [], + "mac": [], + "ip_mask": [] + } + } + }, + "hostContextExclude": ["class_value"], + "hostContextInclude": ["class_value"] } } ``` - **Operators:** For filtering you can use the operators below: @@ -108,7 +93,6 @@ For filtering you can use the operators below: | is_reported | | is_not_reported | - ``` curl -k --user : \ -X POST \ @@ -130,11 +114,12 @@ curl -k --user : \ }' ``` - **Example response:** ```json -{"id":"4"} +{ + "id": "4" +} ``` ## Update group @@ -180,34 +165,20 @@ curl -k --user : \ ```json { "filter": { - "filter":{ - "Attribute name": { - "operator":"value2" - } - }, + "filter": { "Attribute name": {"operator": "value2"} }, "hostFilter": { "includes": { - "includeAdditionally": false, + "includeAdditionally": false, "entries": { - "ip": [ - "192.168.56.5" - ], + "ip": ["192.168.56.5"], "hostkey": [], - "hostname": [ - "ubuntu-bionic" - ], - "mac": [ - "08:00:27:0b:a4:99", - "08:00:27:dd:e1:59", - "02:9f:d3:59:7e:90" - ], - "ip_mask": [ - "10.0.2.16/16" - ] + "hostname": ["ubuntu-bionic"], + "mac": ["08:00:27:0b:a4:99", "08:00:27:dd:e1:59", "02:9f:d3:59:7e:90"], + "ip_mask": ["10.0.2.16/16"] } }, "excludes": { - "entries":{ + "entries": { "ip": [], "hostkey": [], "hostname": [], @@ -216,8 +187,8 @@ curl -k --user : \ } } }, - "hostContextExclude": ["class_value"], - "hostContextInclude": ["class_value"] + "hostContextExclude": ["class_value"], + "hostContextInclude": ["class_value"] } } ``` @@ -243,7 +214,6 @@ For filtering you can use the operators below: | is_reported | | is_not_reported | - **Example request:** ``` @@ -267,11 +237,12 @@ curl -k --user : \ }' ``` - **Example response:** ```json -{"id":"4"} +{ + "id": "4" +} ``` ## Get group @@ -298,28 +269,21 @@ curl -k --user : \ ```json { - "id": 4, - "name": "AIX hosts", - "priority": 3, - "description": "Host name", - "creator": "admin", - "creation_time": "2023-06-14 10:41:25.601112+00", - "filter": { - "filter": { - "Architecture": { - "matches": "86" - } - }, - "hostContextExclude": "", - "hostContextInclude": [ - "aix" - ] - }, - "type": "shared" + "id": 4, + "name": "AIX hosts", + "priority": 3, + "description": "Host name", + "creator": "admin", + "creation_time": "2023-06-14 10:41:25.601112+00", + "filter": { + "filter": { "Architecture": {"matches": "86"} }, + "hostContextExclude": "", + "hostContextInclude": ["aix"] + }, + "type": "shared" } ``` - ## Remove group **URI:** https://hub.cfengine.com/api/host-groups/shared/:id @@ -340,7 +304,6 @@ curl -k --user : \ -H 'content-type: application/json' ``` - ## Groups list **URI:** https://hub.cfengine.com/api/host-groups/shared @@ -360,47 +323,40 @@ curl -k --user : \ ```json { - "data": [ - { - "id": 1, - "name": "All hosts", - "priority": 1, - "description": "", - "creator": "admin", - "creation_time": "2023-05-29 09:55:36.878271+00", - "filter": [] - }, - { - "id": 4, - "name": "AIX hosts", - "priority": 2, - "description": "Host name", - "creator": "admin", - "creation_time": "2023-06-14 10:41:25.601112+00", - "filter": { - "filter": { - "Architecture": { - "matches": "86" - } - }, - "hostContextExclude": "", - "hostContextInclude": [ - "aix" - ] - } - } - ], - "meta": { - "count": 2, - "page": 1, - "timestamp": 1686739758, - "total": 2, - "hostsCountCacheTime": null + "data": [ + { + "id": 1, + "name": "All hosts", + "priority": 1, + "description": "", + "creator": "admin", + "creation_time": "2023-05-29 09:55:36.878271+00", + "filter": [] + }, + { + "id": 4, + "name": "AIX hosts", + "priority": 2, + "description": "Host name", + "creator": "admin", + "creation_time": "2023-06-14 10:41:25.601112+00", + "filter": { + "filter": { "Architecture": {"matches": "86"} }, + "hostContextExclude": "", + "hostContextInclude": ["aix"] + } } + ], + "meta": { + "count": 2, + "page": 1, + "timestamp": 1686739758, + "total": 2, + "hostsCountCacheTime": null + } } ``` - ## Make shared group personal **URI:** https://hub.cfengine.com/api/host-groups/shared/:id/makePersonal @@ -425,7 +381,9 @@ curl -k --user : \ API returns new ID of the personal group. ```json -{"id":"6"} +{ + "id": "6" +} ``` # Shared Groups CMDB @@ -637,7 +595,6 @@ curl -k --user : \ HTTP 200 Ok ``` - ## Update configuration **URI:** https://hub.cfengine.com/api/host-groups/shared/:id/cmdb/:type/:name/ @@ -689,8 +646,6 @@ curl -k --user : \ HTTP 200 Ok ``` - - ## Delete group's configurations **URI:** https://hub.cfengine.com/api/host-groups/shared/:id/cmdb @@ -733,7 +688,6 @@ HTTP 204 No Content * **name** *(string)* Configuration name. Classes or variables name. - **Example request (curl):** ```console diff --git a/content/api/enterprise-api-ref/sql-schema/cfdb.markdown b/content/api/enterprise-api-ref/sql-schema/cfdb.markdown index d0a58332e..4e02ab57d 100644 --- a/content/api/enterprise-api-ref/sql-schema/cfdb.markdown +++ b/content/api/enterprise-api-ref/sql-schema/cfdb.markdown @@ -195,7 +195,6 @@ CFEngine contexts set on hosts by CFEngine over period of time. * **MetaTags** *(text[])* List of [meta tags][Tags for variables, classes, and bundles] set for the context. - **Example query:** ```sql @@ -517,7 +516,6 @@ Inventory data grouped by host * **values** *(jsonb)* Inventory values presented in JSON format - **Example query:** ```sql @@ -1009,8 +1007,6 @@ logmessages | {} promisees | {} ``` - - ## Table: PromiseLog History of promises executed on hosts. @@ -1444,7 +1440,6 @@ patcharchitecture | default patchreporttype | AVAILABLE ``` - ## Table: Variables Variables and their values set on hosts at their last reported cf-agent execution. diff --git a/content/api/enterprise-api-ref/sql-schema/cfsettings.markdown b/content/api/enterprise-api-ref/sql-schema/cfsettings.markdown index 094420682..488d4b0d0 100644 --- a/content/api/enterprise-api-ref/sql-schema/cfsettings.markdown +++ b/content/api/enterprise-api-ref/sql-schema/cfsettings.markdown @@ -26,7 +26,6 @@ Stores system logs about actions performed by users. * **ip_address** *(boolean)* IP address of the user who performed the action. - ## Table: build_modules Information about build modules available from the index (build.cfengine.com). diff --git a/content/api/enterprise-api-ref/status-settings.markdown b/content/api/enterprise-api-ref/status-settings.markdown index ec6a279b6..b63a4ba67 100644 --- a/content/api/enterprise-api-ref/status-settings.markdown +++ b/content/api/enterprise-api-ref/status-settings.markdown @@ -105,7 +105,6 @@ API call allowed only for administrator. See [Update settings][Status and settings REST API#Update settings] field section for output descriptions - **Example usage:** `Example: Viewing settings` ## Update settings diff --git a/content/api/enterprise-api-ref/two-factor-authentication.markdown b/content/api/enterprise-api-ref/two-factor-authentication.markdown index 700f9da1a..fbf5d7fbf 100644 --- a/content/api/enterprise-api-ref/two-factor-authentication.markdown +++ b/content/api/enterprise-api-ref/two-factor-authentication.markdown @@ -69,8 +69,6 @@ HTTP 200 Ok | 200 OK | 2FA configuration successfully created | | 500 Internal server error | Internal server error | - - ## Complete two-factor authentication configuration **URI:** https://hub.cfengine.com/api/2fa/totp/configure @@ -106,7 +104,6 @@ HTTP 200 Ok | 400 Bad request | 2FA verification failed. | | 500 Internal server error | Internal server error | - ## Disable two-factor authentication for the current user **URI:** https://hub.cfengine.com/api/2fa/totp/disable @@ -177,8 +174,6 @@ HTTP 200 Ok | 409 Conflict | 2FA is not enabled for this user | | 500 Internal server error | Internal server error | - - ## Verify two-factor authentication code This API endpoint verifies the authentication code. If OAuth authentication is used and the code is valid, @@ -218,7 +213,6 @@ HTTP 200 Ok | 409 Conflict | 2FA is not enabled for this user | | 500 Internal server error | Internal server error | - ## Check if verification is needed This API endpoint checks if 2FA verification is needed. Only needed for OAuth authentication method @@ -228,7 +222,6 @@ as for the Basic authentication is needed every time. **Method:** GET - **Example request (curl):** ```console diff --git a/content/api/enterprise-api-ref/vcs-settings.markdown b/content/api/enterprise-api-ref/vcs-settings.markdown index 0344e0bbb..9fc56f8c7 100644 --- a/content/api/enterprise-api-ref/vcs-settings.markdown +++ b/content/api/enterprise-api-ref/vcs-settings.markdown @@ -6,7 +6,6 @@ VCS API for managing version control repository settings. ## Get VCS settings - **URI:** https://hub.cfengine.com/api/vcs/settings **Method:** GET diff --git a/content/api/enterprise-api-ref/web-rbac.markdown b/content/api/enterprise-api-ref/web-rbac.markdown index bb39d99cd..25c5387a5 100644 --- a/content/api/enterprise-api-ref/web-rbac.markdown +++ b/content/api/enterprise-api-ref/web-rbac.markdown @@ -108,7 +108,6 @@ curl -k --user : \ ] ``` - ## Get role permissions **URI:** https://hub.cfengine.com/api/role/:role_name/permissions @@ -191,7 +190,6 @@ curl -k --user : \ HTTP 201 Created ``` - ## Rewrite role's permissions **URI:** https://hub.cfengine.com/api/role/:role_name/permissions @@ -224,7 +222,6 @@ curl -k --user : \ HTTP 201 Created ``` - ## Revoke permissions from role **URI:** https://hub.cfengine.com/api/role/:role_name/permissions diff --git a/content/enterprise-cfengine-guide/install-get-started.markdown b/content/enterprise-cfengine-guide/install-get-started.markdown index 2e10b945e..fcf101042 100644 --- a/content/enterprise-cfengine-guide/install-get-started.markdown +++ b/content/enterprise-cfengine-guide/install-get-started.markdown @@ -10,7 +10,6 @@ Delete "Enterprise Install and Get Started" https://docs.google.com/document/d/1CeRR8cuMtrrr0X27gzVzP2ndiU0HuHvo7dJT2vIWfp0/edit#heading=h.978wiks7ber1 --> - * [Installation][Install and Get Started#Installation] * [Post-install configuration][Install and Get Started#Post-install configuration] diff --git a/content/examples/_index.markdown b/content/examples/_index.markdown index dbfdc7515..374091efc 100644 --- a/content/examples/_index.markdown +++ b/content/examples/_index.markdown @@ -45,8 +45,7 @@ Following these steps, you will login to your policy server via the SSH protocol 3. To get to the __masterfiles__ directory, type ```cd /var/cfengine/masterfiles```. 4. Create the file with the command: ```vi hello_world.cf ``` 5. In the vi editor, enter ```i``` for "Insert" and enter the following content (ie. copy and paste from a text editor): - ```cf3 - [file=hello_world.cf] + ```cf3 {file="hello_world.cf"} bundle agent hello_world { reports: @@ -190,7 +189,6 @@ And it can now be run directly: 2013-08-20T14:39:34-0500 notice: R: Hello World! ``` - ### Integrating the example into your main policy Make the example policy part of your main policy by diff --git a/content/examples/example-snippets/basic-file-directory.markdown b/content/examples/example-snippets/basic-file-directory.markdown index 6e3d52c5d..b8713aeb7 100644 --- a/content/examples/example-snippets/basic-file-directory.markdown +++ b/content/examples/example-snippets/basic-file-directory.markdown @@ -34,78 +34,64 @@ sorting: 6 Create files and directories and set permissions. - [%CFEngine_include_snippet(create_files_and_directories.cf, .* )%] ## Copy single files Copy single files, locally (local_cp) or from a remote site (secure_cp). The Community Open Promise-Body Library (COPBL; cfengine_stdlib.cf) should be included in the /var/cfengine/inputs/ directory and input as below. - [%CFEngine_include_snippet(copy_single_files.cf, .* )%] ## Copy directory trees Copy directory trees, locally (local_cp) or from a remote site (secure_cp). (depth_search => recurse("")) defines the number of sublevels to include, ("inf") gets entire tree. - [%CFEngine_include_snippet(copy_directory_trees.cf, .* )%] ## Disabling and rotating files Use the following simple steps to disable and rotate files. See the Community Open Promise-Body Library if you wish more details on what disable and rotate does. - [%CFEngine_include_snippet(disabling_and_rotating_files.cf, .* )%] ## Add lines to a file There are numerous approaches to adding lines to a file. Often the order of a configuration file is unimportant, we just need to ensure settings within it. A simple way of adding lines is show below. - [%CFEngine_include_snippet(add_lines_to_a_file.cf, .* )%] Also you could write this using a list variable: - [%CFEngine_include_snippet(add_lines_to_a_file_1.cf, .* )%] ## Check file or directory permissions - [%CFEngine_include_snippet(check_file_or_directory_permissions.cf, .* )%] ## Commenting lines in a file - [%CFEngine_include_snippet(commenting_lines_in_a_file.cf, .* )%] ## Copy files - [%CFEngine_include_snippet(copy_files.cf, .* )%] - ## Copy and flatten directory - [%CFEngine_include_snippet(copy_and_flatten_directory.cf, .* )%] ## Copy then edit a file convergently To convergently chain a copy followed by edit, you need a staging file. First you copy to the staging file. Then you edit the final file and insert the staging file into it as part of the editing. This is convergent with respect to both stages of the process. - [%CFEngine_include_snippet(copy_then_edit_a_file_convergently.cf, .* )%] ## Deleting lines from a file - [%CFEngine_include_snippet(deleting_lines_from_a_file.cf, .* )%] ## Deleting lines exception - [%CFEngine_include_snippet(deleting_lines_exception.cf, .* )%] ## Delete files recursively @@ -118,28 +104,22 @@ This is a huge topic. See also See Add lines to a file, See Editing tabular file Here is an example of how to comment out lines matching a number of patterns: - [%CFEngine_include_snippet(editing_files.cf, .* )%] - ## Editing tabular files - [%CFEngine_include_snippet(editing_tabular_files.cf, .* )%] ## Inserting lines in a file - [%CFEngine_include_snippet(inserting_lines_in_a_file.cf, .* )%] ## Back references in filenames - [%CFEngine_include_snippet(back_references_in_filenames.cf, .* )%] ## Add variable definitions to a file - [%CFEngine_include_snippet(add_variable_definitions_to_a_file.cf, .* )%] Results in: @@ -150,37 +130,30 @@ Results in: An example of this would be to add variables to /etc/sysctl.conf on Linux: - [%CFEngine_include_snippet(add_variable_definitions_to_a_file_1.cf, .* )%] ## Linking files - [%CFEngine_include_snippet(linking_files.cf, .* )%] ## Listing files-pattern in a directory - [%CFEngine_include_snippet(listing_files-pattern_in_a_directory.cf, .* )%] ## Locate and transform files - [%CFEngine_include_snippet(locate_and_transform_files.cf, .* )%] ## BSD flags - [%CFEngine_include_snippet(bsd_flags.cf, .* )%] ## Search and replace text - [%CFEngine_include_snippet(search_and_replace_text.cf, .* )%] ## Selecting a region in a file - [%CFEngine_include_snippet(selecting_a_region_in_a_file.cf, .* )%] ## Warn if matching line in file diff --git a/content/examples/example-snippets/cfengine-administration.markdown b/content/examples/example-snippets/cfengine-administration.markdown index d0aa7dcaf..d4292cd14 100644 --- a/content/examples/example-snippets/cfengine-administration.markdown +++ b/content/examples/example-snippets/cfengine-administration.markdown @@ -15,7 +15,6 @@ This shows how dependencies can be chained in spite of the order of promises in Normally the order of promises in a bundle is followed, within each promise type, and the types are ordered according to normal ordering. - [%CFEngine_include_snippet(ordering_promises.cf, .* )%] ## Aborting execution diff --git a/content/examples/example-snippets/commands-scripts-execution.markdown b/content/examples/example-snippets/commands-scripts-execution.markdown index d0e3071e4..bd5c6a2f8 100644 --- a/content/examples/example-snippets/commands-scripts-execution.markdown +++ b/content/examples/example-snippets/commands-scripts-execution.markdown @@ -16,12 +16,10 @@ sorting: 5 Execute a command, for instance to start a MySQL service. Note that simple shell commands like rm or mkdir cannot be managed by CFEngine, so none of the protections that CFEngine offers can be applied to the process. Moreover, this starts a new process, adding to the burden on the system. - [%CFEngine_include_snippet(command_or_script_execution.cf, .* )%] ## Change directory for command - [%CFEngine_include_snippet(change_directory_for_command.cf, .* )%] ## Commands example @@ -30,17 +28,14 @@ Execute a command, for instance to start a MySQL service. Note that simple shell ## Execresult example - [%CFEngine_include_snippet(execresult_example.cf, .* )%] ## Methods - [%CFEngine_include_snippet(methods.cf, .* )%] ## Method validation - [%CFEngine_include_snippet(method_validation.cf, .* )%] ## Trigger classes diff --git a/content/examples/example-snippets/file-template.markdown b/content/examples/example-snippets/file-template.markdown index 178aad3d7..e09711510 100644 --- a/content/examples/example-snippets/file-template.markdown +++ b/content/examples/example-snippets/file-template.markdown @@ -15,13 +15,10 @@ With CFEngine you have a choice between editing _deltas_ into files or distribut Example template: - [%CFEngine_include_snippet(templating.cf, .* )%] - To copy and expand this template, you can use a pattern like this: - [%CFEngine_include_snippet(templating_1.cf, .* )%] The the following driving code (based on _copy then edit_) can be placed in a library, after configuring to your environmental locations: diff --git a/content/examples/example-snippets/general.markdown b/content/examples/example-snippets/general.markdown index bd4cee0b1..4f652a954 100644 --- a/content/examples/example-snippets/general.markdown +++ b/content/examples/example-snippets/general.markdown @@ -12,7 +12,6 @@ sorting: 1 To get started with CFEngine, you can imagine the following template for entering examples. This part of the code is common to all the examples. - [%CFEngine_include_snippet(basic_example.cf, .* )%] ## The general pattern @@ -27,7 +26,6 @@ what_type: ## Traditional comment - "promiser" -> { "promisee1", "promisee2" }, comment => "The intention ...", handle => "unique_id_label", @@ -38,7 +36,6 @@ what_type: ### Hello world - [%CFEngine_include_snippet(hello_world.cf, .* )%] ### Array example diff --git a/content/examples/example-snippets/network.markdown b/content/examples/example-snippets/network.markdown index 74fc22795..ec96dbd72 100644 --- a/content/examples/example-snippets/network.markdown +++ b/content/examples/example-snippets/network.markdown @@ -18,7 +18,6 @@ sorting: 9 Finding the ethernet address can be hard, but on Linux it is straightforward. - [%CFEngine_include_snippet(find_mac_address.cf, .* )%] ## Client-server example @@ -27,24 +26,20 @@ Finding the ethernet address can be hard, but on Linux it is straightforward. ## Read from a TCP socket - [%CFEngine_include_snippet(read_from_a_tcp_socket.cf, .* )%] ## Set up a PXE boot server Use CFEngine to set up a PXE boot server. - [%CFEngine_include_snippet(set_up_a_pxe_boot_server.cf, .* )%] ## Resolver management - [%CFEngine_include_snippet(resolver_management.cf, .* )%] ## Mount NFS filesystem - [%CFEngine_include_snippet(mount_nfs_filesystem.cf, .* )%] ## Unmount NFS filesystem diff --git a/content/examples/example-snippets/promise-patterns/example_change_detection.markdown b/content/examples/example-snippets/promise-patterns/example_change_detection.markdown index 10d0b6fa3..c357d846b 100644 --- a/content/examples/example-snippets/promise-patterns/example_change_detection.markdown +++ b/content/examples/example-snippets/promise-patterns/example_change_detection.markdown @@ -13,7 +13,6 @@ Here is an example run. First, let's create some files for CFEngine to monitor: - ``` # mkdir /etc/example # date > /etc/example/example.conf diff --git a/content/examples/example-snippets/promise-patterns/example_edit_motd.markdown b/content/examples/example-snippets/promise-patterns/example_edit_motd.markdown index 5b779d5ac..cce66ff6f 100644 --- a/content/examples/example-snippets/promise-patterns/example_edit_motd.markdown +++ b/content/examples/example-snippets/promise-patterns/example_edit_motd.markdown @@ -23,10 +23,8 @@ render a `/etc/motd` using a mustache template and add useful information as: The bundle is defined like this: - [%CFEngine_include_example(mustache_template_motd.cf)%] - **Example run:** ```command diff --git a/content/examples/example-snippets/promise-patterns/example_enable_service.markdown b/content/examples/example-snippets/promise-patterns/example_enable_service.markdown index d34d277b3..a7cdbc2f8 100644 --- a/content/examples/example-snippets/promise-patterns/example_enable_service.markdown +++ b/content/examples/example-snippets/promise-patterns/example_enable_service.markdown @@ -133,7 +133,6 @@ info: Completed execution of '/etc/init.d/cups stop' After the policy run we can see that `systat` is still not reporting status correctly (some services do not respond to standard checks), `apache2`, and `cups` are *inactive*. `ssh` and `cron` are *active* as specified in the policy. - ```command service sysstat status; echo $? ``` diff --git a/content/examples/example-snippets/promise-patterns/example_find_mac_addr.markdown b/content/examples/example-snippets/promise-patterns/example_find_mac_addr.markdown index 77c334359..7826bcdc7 100644 --- a/content/examples/example-snippets/promise-patterns/example_find_mac_addr.markdown +++ b/content/examples/example-snippets/promise-patterns/example_find_mac_addr.markdown @@ -17,7 +17,6 @@ body common control bundlesequence => { "example" }; } - bundle agent example { vars: @@ -93,7 +92,6 @@ body common control bundlesequence => { "example" }; } - bundle agent example { vars: diff --git a/content/examples/example-snippets/promise-patterns/example_install_package.markdown b/content/examples/example-snippets/promise-patterns/example_install_package.markdown index 69e34abaf..ec8721e74 100644 --- a/content/examples/example-snippets/promise-patterns/example_install_package.markdown +++ b/content/examples/example-snippets/promise-patterns/example_install_package.markdown @@ -5,7 +5,6 @@ reviewed: 2013-06-08 reviewed-by: atsaloli --- - Install desired packages. ```cf3 diff --git a/content/examples/example-snippets/promise-patterns/example_mount_nfs.markdown b/content/examples/example-snippets/promise-patterns/example_mount_nfs.markdown index beb80b4e1..443d904be 100644 --- a/content/examples/example-snippets/promise-patterns/example_mount_nfs.markdown +++ b/content/examples/example-snippets/promise-patterns/example_mount_nfs.markdown @@ -13,7 +13,6 @@ body common control bundlesequence => { "mounts" }; } - bundle agent mounts { storage: @@ -23,7 +22,6 @@ storage: # "/home" is the path to the remote file system } - body mount nfs(server,source) { mount_type => "nfs"; # Protocol type of remote file system diff --git a/content/examples/example-snippets/promise-patterns/example_ntp.markdown b/content/examples/example-snippets/promise-patterns/example_ntp.markdown index fa3fccefe..9a0334456 100644 --- a/content/examples/example-snippets/promise-patterns/example_ntp.markdown +++ b/content/examples/example-snippets/promise-patterns/example_ntp.markdown @@ -5,7 +5,6 @@ reviewed: 2013-06-09 reviewed-by: atsaloli --- - The following sets up a local NTP server that synchronizes with pool.ntp.org and clients that synchronize with your local NTP server. See bottom of this example if you don't want to build a server, but use a "brute force" method (repeated diff --git a/content/examples/example-snippets/promise-patterns/example_process_restart.markdown b/content/examples/example-snippets/promise-patterns/example_process_restart.markdown index 4081fa2ec..1665fb3b0 100644 --- a/content/examples/example-snippets/promise-patterns/example_process_restart.markdown +++ b/content/examples/example-snippets/promise-patterns/example_process_restart.markdown @@ -13,7 +13,6 @@ body common control bundlesequence => { "process_restart" }; } - bundle agent process_restart { vars: diff --git a/content/examples/example-snippets/promise-patterns/example_ssh_keys.markdown b/content/examples/example-snippets/promise-patterns/example_ssh_keys.markdown index f9a3024ec..df2fdb170 100644 --- a/content/examples/example-snippets/promise-patterns/example_ssh_keys.markdown +++ b/content/examples/example-snippets/promise-patterns/example_ssh_keys.markdown @@ -15,9 +15,7 @@ simply create it with the following content. ```json {file="def.json"} { - "classes": { - "services_autorun": [ "any" ] - } + "classes": { "services_autorun": ["any"] } } ``` diff --git a/content/examples/example-snippets/promise-patterns/example_sudoers.markdown b/content/examples/example-snippets/promise-patterns/example_sudoers.markdown index 4439aebd6..bfed4311b 100644 --- a/content/examples/example-snippets/promise-patterns/example_sudoers.markdown +++ b/content/examples/example-snippets/promise-patterns/example_sudoers.markdown @@ -14,7 +14,6 @@ bundlesequence => { "sudoers" }; inputs => { "libraries/cfengine_stdlib.cf" }; } - bundle agent sudoers { @@ -23,7 +22,6 @@ vars: "master_location" string => "/var/cfengine/masterfiles"; - # Copy the master sudoers file to /etc/sudoers files: diff --git a/content/examples/example-snippets/software-adminstration.markdown b/content/examples/example-snippets/software-adminstration.markdown index ca524ccea..4b8b0455a 100644 --- a/content/examples/example-snippets/software-adminstration.markdown +++ b/content/examples/example-snippets/software-adminstration.markdown @@ -20,17 +20,14 @@ sorting: 4 Example for Debian: - [%CFEngine_include_snippet(software_and_patch_installation.cf, .* )%] Examples MSI for Windows, by name: - [%CFEngine_include_snippet(software_and_patch_installation_1.cf, .* )%] Windows MSI by version: - [%CFEngine_include_snippet(software_and_patch_installation_1.cf, .* )%] Examples for solaris: @@ -47,36 +44,30 @@ SuSE Linux's package manager zypper is the most powerful alternative: ## Postfix mail configuration - [%CFEngine_include_snippet(postfix_mail_configuration.cf, .* )%] ## Set up a web server Adapt this template to your operating system by adding multiple classes. Each web server runs something like the present module, which is entered into the bundlesequence like this: - [%CFEngine_include_snippet(set_up_a_web_server.cf, .* )%] ## Add software packages to the system - [%CFEngine_include_snippet(add_software_packages_to_the_system.cf, .* )%] Note you can also arrange to hide all the differences between package managers on an OS basis, but since some OSs have multiple managers, this might not be 100 percent correct. ## Application baseline - [%CFEngine_include_snippet(application_baseline.cf, .* )%] ## Service management (windows) - [%CFEngine_include_snippet(service_management_(windows).cf, .* )%] ## Software distribution - [%CFEngine_include_snippet(software_distribution.cf, .* )%] ## Web server modules diff --git a/content/examples/example-snippets/system-administration.markdown b/content/examples/example-snippets/system-administration.markdown index aebb6151b..76c37cbff 100644 --- a/content/examples/example-snippets/system-administration.markdown +++ b/content/examples/example-snippets/system-administration.markdown @@ -12,43 +12,36 @@ These examples show a simple setup for starting with a central approach to manag This shows the simplest approach in which all hosts are the same. It is too simple for most environments, but it serves as a starting point. Compare it to the next section that includes variation. - [%CFEngine_include_snippet(all_hosts_the_same.cf, .* )%] ### Variation in hosts - [%CFEngine_include_snippet(variation_in_hosts.cf, .* )%] ### Updating from a central hub The configuration bundled with the CFEngine source code contains an example of centralized updating of policy that covers more subtleties than this example, and handles fault tolerance. Here is the main idea behind it. For simplicity, we assume that all hosts are on network 10.20.30.* and that the central policy server/hub is 10.20.30.123. - [%CFEngine_include_snippet(updating_from_a_central_hub.cf, .* )%] ## Laptop support configuration Laptops do not need a lot of confguration support. IP addresses are set by DHCP and conditions are changeable. But you want to set your DNS search domains to familiar settings in spite of local DHCP configuration, and another useful trick is to keep a regular backup of disk changes on the local disk. This won't help against disk destruction, but it is a huge advantage when your user accidentally deletes files while travelling or offline. - [%CFEngine_include_snippet(laptop_support_configuration.cf, .* )%] ## Process management - [%CFEngine_include_snippet(process_management.cf, .* )%] ## Kill process - [%CFEngine_include_snippet(kill_process.cf, .* )%] ## Restart process A basic pattern for restarting processes: - [%CFEngine_include_snippet(restart_process.cf, .* )%] This can be made more sophisticated to handle generic lists: @@ -59,10 +52,8 @@ Why? Separating this into two parts gives a high level of control and conistency ## Mount a filesystem - [%CFEngine_include_snippet(mount_a_filesystem.cf, .* )%] - ## Manage a system process Ensure running @@ -73,31 +64,26 @@ Why? Separating this into two parts gives a high level of control and conistency The simplest example might look like this: - [%CFEngine_include_snippet(ensure_running.cf, .* )%] This example shows how the CFEngine components could be started using a pattern. - [%CFEngine_include_snippet(ensure_running_1.cf, .* )%] ### Ensure not running - [%CFEngine_include_snippet(ensure_not_running.cf, .* )%] ### Prune processes This example kills processes owned by a particular user that have exceeded 100000 bytes of resident memory. - [%CFEngine_include_snippet(prune_processes.cf, .* )%] ## Set up HPC clusters HPC cluster machines are usually all identical, so the CFEngine configuration is very simple. HPC clients value CPU and memory resources, so we can shut down unnecessary services to save CPU. We can also change the scheduling rate of CFEngine to run less frequently, and save a little: - [%CFEngine_include_snippet(set_up_hpc_clusters.cf, .* )%] ## Set up name resolution @@ -106,34 +92,28 @@ There are many ways to do name resolution setup1 We write a reusable bundle usin A simple and straightforward approach is to maintain a separate modular bundle for this task. This avoids too many levels of abstraction and keeps all the information in one place. We implement this as a simple editing promise for the /etc/resolv.conf file. - [%CFEngine_include_snippet(set_up_name_resolution.cf, .* )%] A second approach is to try to conceal the operational details behind a veil of abstraction. - [%CFEngine_include_snippet(set_up_name_resolution_1.cf, .* )%] DNS is not the only name service, of course. Unix has its older /etc/hosts file which can also be managed using file editing. We simply append this to the system_files bundle. - [%CFEngine_include_snippet(set_up_name_resolution_1.cf, .* )%] ## Set up sudo Setting up sudo is straightforward, and is best managed by copying trusted files from a repository. - [%CFEngine_include_snippet(set_up_sudo.cf, .* )%] ## Environments (virtual) - [%CFEngine_include_snippet(environments_(virtual).cf, .* )%] ## Environment variables - [%CFEngine_include_snippet(environment_variables.cf, .* )%] ## Tidying garbage files diff --git a/content/examples/example-snippets/system-file.markdown b/content/examples/example-snippets/system-file.markdown index 1eef8a27f..b46a5acea 100644 --- a/content/examples/example-snippets/system-file.markdown +++ b/content/examples/example-snippets/system-file.markdown @@ -8,24 +8,20 @@ sorting: 13 To change the password of a system, we need to edit a file. A file is a complex object - once open there is a new world of possible promises to make about its contents. CFEngine has bundles of promises that are specially for editing. - [%CFEngine_include_snippet(editing_password_or_group_files.cf, .* )%] ## Editing password or group files custom In this example the bundles from the Community Open Promise-Body Library are included directly in the policy instead of being input as a separate file. - [%CFEngine_include_snippet(editing_password_or_group_files_custom.cf, .* )%] ## Log rotation - [%CFEngine_include_snippet(log_rotation.cf, .* )%] ## Garbage collection - [%CFEngine_include_snippet(garbage_collection.cf, .* )%] ## Manage a system file @@ -37,7 +33,6 @@ In this example the bundles from the Community Open Promise-Body Library are inc ### Simple template - [%CFEngine_include_snippet(simple_template.cf, .* )%] ### Simple versioned template @@ -46,26 +41,22 @@ The simplest approach to managing a file is to maintain a master copy by hand, k We'll assume that you have a version control repository that is located on some independent server, and has been checked out manually once (with authentication) in /mysite/masterfiles. - [%CFEngine_include_snippet(simple_versioned_template.cf, .* )%] ### Macro template The next simplest approach to file management is to add variables to the template that will be expanded into local values at the end system, e.g. using variables like `$(sys.host)` for the name of the host within the body of the versioned template. - [%CFEngine_include_snippet(macro_template.cf, .* )%] The macro template file may contain variables, as below, that get expanded by CFEngine. - [%CFEngine_include_snippet(macro_template_1.cf, .* )%] ### Custom editing If you do not control the starting state of the file, because it is distributed by an operating system vendor for instance, then editing the final state is the best approach. That way, you will get changes that are made by the vendor, and will ensure your own modifications are kept even when updates arrive. - [%CFEngine_include_snippet(custom_editing.cf, .* )%] Another example shows how to set the values of variables using a data-driven approach and methods from the standard library. diff --git a/content/examples/example-snippets/system-information.markdown b/content/examples/example-snippets/system-information.markdown index 5314487bd..292f73305 100644 --- a/content/examples/example-snippets/system-information.markdown +++ b/content/examples/example-snippets/system-information.markdown @@ -14,30 +14,24 @@ sorting: 11 ## Change detection - [%CFEngine_include_snippet(change_detection.cf, .* )%] ## Hashing for change detection (tripwire) Change detection is a powerful and easy way to monitor your environment, increase awareness and harden your system against security breaches. - [%CFEngine_include_snippet(hashing_for_change_detection_(tripwire).cf, .* )%] ## Check filesystem space - [%CFEngine_include_snippet(check_filesystem_space.cf, .* )%] ## Class match example - [%CFEngine_include_snippet(class_match_example.cf, .* )%] ## Global classes - - [%CFEngine_include_snippet(global_classes.cf, .* )%] ## Logging diff --git a/content/examples/example-snippets/system-security.markdown b/content/examples/example-snippets/system-security.markdown index 3ce1af496..143739964 100644 --- a/content/examples/example-snippets/system-security.markdown +++ b/content/examples/example-snippets/system-security.markdown @@ -10,7 +10,6 @@ sorting: 10 ## Distribute root passwords - [%CFEngine_include_snippet(distribute_root_passwords.cf, .* )%] ## Distribute ssh keys diff --git a/content/examples/example-snippets/user-management.markdown b/content/examples/example-snippets/user-management.markdown index 4fc2ffd9c..ab30fcbce 100644 --- a/content/examples/example-snippets/user-management.markdown +++ b/content/examples/example-snippets/user-management.markdown @@ -108,7 +108,6 @@ absent on linux systems using the native `users` type promise. [%CFEngine_include_example(local_users_absent.cf)%] - Before activating the example policy, lets inspect the current state of the system. diff --git a/content/examples/example-snippets/windows-registry.markdown b/content/examples/example-snippets/windows-registry.markdown index a1309c1b6..0f43db78c 100644 --- a/content/examples/example-snippets/windows-registry.markdown +++ b/content/examples/example-snippets/windows-registry.markdown @@ -10,12 +10,10 @@ sorting: 14 ## Windows registry - [%CFEngine_include_snippet(windows_registry.cf, .* )%] ## unit_registry_cache.cf - [%CFEngine_include_snippet(unit_registry_cache.cf.cf, .* )%] ## unit_registry.cf diff --git a/content/examples/tutorials/custom_inventory.markdown b/content/examples/tutorials/custom_inventory.markdown index 598469fca..20e51d523 100644 --- a/content/examples/tutorials/custom_inventory.markdown +++ b/content/examples/tutorials/custom_inventory.markdown @@ -87,10 +87,8 @@ Create `/var/cfengine/masterfiles/def.json` and populate it with the following c ```json { - "inputs": [ "services/tutorials/inventory/owner.cf" ], - "vars": { - "control_common_bundlesequence_end": [ "tutorials_inventory_owner" ] - } + "inputs": ["services/tutorials/inventory/owner.cf"], + "vars": { "control_common_bundlesequence_end": ["tutorials_inventory_owner"] } } ``` diff --git a/content/examples/tutorials/distribute-files-from-a-central-location.markdown b/content/examples/tutorials/distribute-files-from-a-central-location.markdown index c1bc633f8..6202b9f73 100644 --- a/content/examples/tutorials/distribute-files-from-a-central-location.markdown +++ b/content/examples/tutorials/distribute-files-from-a-central-location.markdown @@ -186,7 +186,6 @@ Now that all of the policy has been edited and is in place, check for syntax err running `cf-promises -f ./promises.cf`. This promise is activated from the **service_catalogue** bundle. - ## Commit Changes ### Set up trackers in the Mission Portal (Enterprise Users Only) @@ -200,7 +199,6 @@ in the right-hand panel. Click **Add new tracker**. ![Mission Portal Host Event](hosts-add-new-tracker.png) - Name it *Patch Failure*. Set the **Report Type** to *Promise not Kept*. Under **Watch**, enter **.patch**. Set the **Start Time** to **Now** and then click **Done** to close the Start Time window. Click **Start** to save the new tracker. diff --git a/content/examples/tutorials/files-tutorial.markdown b/content/examples/tutorials/files-tutorial.markdown index 88d39bba1..38a8a3646 100644 --- a/content/examples/tutorials/files-tutorial.markdown +++ b/content/examples/tutorials/files-tutorial.markdown @@ -27,8 +27,7 @@ Note: The following workflow assumes the directory /home/user already exists. If 1. Create a file /var/cfengine/masterfiles/file_test.cf that includes the following text: - ```cf3 - [file=file_test.cf] + ```cf3 {file="file_test.cf"} bundle agent list_file { vars: @@ -279,7 +278,6 @@ body perms system } ``` - ```bash /var/cfengine/bin/cf-agent --no-lock --file ./file_test.cf --bundlesequence list_file,test_delete,list_file_2 ls /home/user/test_plain.txt diff --git a/content/examples/tutorials/high-availability/_index.markdown b/content/examples/tutorials/high-availability/_index.markdown index 531b44e08..100da7a34 100644 --- a/content/examples/tutorials/high-availability/_index.markdown +++ b/content/examples/tutorials/high-availability/_index.markdown @@ -12,7 +12,6 @@ introduced in 3.6.2. Essentially it is based on well known and broadly used clu management tools - [corosync](https://corosync.github.io/corosync/) and [pacemaker](https://clusterlabs.org/pacemaker/) as well as PostgreSQL streaming replication feature. - ## Design CFEngine High availability is based on redundancy of all components, most importantly the PostgreSQL @@ -40,7 +39,6 @@ accessing Mission Portal so that once failover happens the change of active-pass failover transition is transparent for end user. They can still use the same shared IP address to log in to the Mission Portal or use against API queries. - ### PostgreSQL For best performance, PostgreSQL streaming replication was selected as the database replication @@ -50,7 +48,6 @@ and almost immediate visibility of data inserted to primary server by the standb information about PostgreSQL streaming replication please see [PostgreSQL documentation](https://wiki.postgresql.org/wiki/Streaming_Replication). - ## CFEngine In a High availability setup all the clients are aware of existence of more than one hub. Current @@ -78,7 +75,6 @@ knowledge and overview of the whole setup. HADegraded - ### Inventory There are also new Mission Portal inventory variables indicating the IP address of the active hub @@ -88,7 +84,6 @@ reports is especially helpful to diagnose any problems when High availability is HAInventory - ### CFEngine High availability installation Existing CFEngine Enterprise installations can upgrade their single-node hub to a High availability diff --git a/content/examples/tutorials/high-availability/installation-guide.markdown b/content/examples/tutorials/high-availability/installation-guide.markdown index 9d52ef556..b37d2aee1 100644 --- a/content/examples/tutorials/high-availability/installation-guide.markdown +++ b/content/examples/tutorials/high-availability/installation-guide.markdown @@ -50,7 +50,6 @@ Detailed network configuration is shown on the picture below: ![HAGuideNetworkSetup](ha_network_setup.png) - ## Install cluster management tools **On both nodes:** @@ -63,7 +62,6 @@ In order to operate cluster, proper fencing must be configured but description h and what mechanism use is out of the scope of this document. For reference please use the [Red Hat HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/configuring_the_red_hat_high_availability_add-on_with_pacemaker/ch-fencing-haar). - **IMPORTANT:** please carefully follow the indicators describing if the given step should be performed on the active (node1), the passive (node2) or both nodes. @@ -130,7 +128,6 @@ HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterpri No resources - Daemon Status: cman: active/disabled corosync: active/disabled @@ -437,7 +434,6 @@ HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterpri *cfpgsql-status* for the active node is reported as *PRI* and passive as *HS:async* or *HS:alone*. - ### CFEngine configuration 1. Create the HA configuration file **on both nodes**. @@ -514,12 +510,9 @@ HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterpri 6. **On both nodes,** add the following class definition to the */var/cfengine/masterfiles/def.json* file to enable HA: - ```json - [file=def.json] + ```json {file="def.json"} { - "classes": { - "enable_cfengine_enterprise_hub_ha": [ "any::" ] - } + "classes": { "enable_cfengine_enterprise_hub_ha": ["any::"] } } ``` @@ -536,7 +529,6 @@ HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterpri https://192.168.100.100 address in your browser. Note that it takes up to 15 minutes for everything to settle and the `OK` HA status being reported in the Mission Portal's header. - ### Configuring 3rd node as disaster-recovery or database backup (optional) 1. Install the CFEngine hub package on the node which will be used as disaster-recovery or database @@ -607,8 +599,6 @@ HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterpri failover to the node3 is not performed). Please also note that during normal operations the cf-hub process should not be running on the node3. - - ### Manual failover to disaster-recovery node 1. Before starting manual failover process make sure both active and passive nodes are not running. @@ -621,8 +611,6 @@ HA fencing guide](https://access.redhat.com/documentation/en-us/red_hat_enterpri **IMPORTANT:** Please note that as long as any of the active or passive cluster nodes is accessible by client to be contacted, failover to 3rd node is not possible. If the active or passive node is running and failover to 3rd node is required make sure to disable network interfaces where clients are bootstrapped to so that clients won't be able to access any other node than disaster-recovery. - - ### Troubleshooting 1. If either the IPaddr2 or pgslq resource is not running, try to enable it first with ```pcs cluster enable --all```. If this is not strting the resources, you can try to run them in debug mode with this command ```pcs resource debug-start ```. The latter command should print diagnostics messages on why resources are not started. diff --git a/content/examples/tutorials/integrating-with-sumo-logic.markdown b/content/examples/tutorials/integrating-with-sumo-logic.markdown index 63d7b3aa7..38cec2502 100644 --- a/content/examples/tutorials/integrating-with-sumo-logic.markdown +++ b/content/examples/tutorials/integrating-with-sumo-logic.markdown @@ -126,7 +126,6 @@ inputs => { That's all. - ## Test it! To test it, we need to make a change to any CFEngine policy, and then go to Sumo Logic to see if there is a new timestamp reported. diff --git a/content/examples/tutorials/json-yaml-support-in-cfengine.markdown b/content/examples/tutorials/json-yaml-support-in-cfengine.markdown index a68de18f0..54211f241 100644 --- a/content/examples/tutorials/json-yaml-support-in-cfengine.markdown +++ b/content/examples/tutorials/json-yaml-support-in-cfengine.markdown @@ -131,7 +131,6 @@ private linux You can also use - ```cf3 "bykey" data => readjson(...); ``` diff --git a/content/examples/tutorials/manage-ntp.markdown b/content/examples/tutorials/manage-ntp.markdown index 0a708aeee..b56ef68bc 100644 --- a/content/examples/tutorials/manage-ntp.markdown +++ b/content/examples/tutorials/manage-ntp.markdown @@ -10,7 +10,6 @@ Note: For simplicity, in this tutorial we will work directly on top of the Maste ## Ensuring the NTP package is installed - ```cf3 {file="ntp.cf"} bundle agent ntp { @@ -124,10 +123,8 @@ Now, we need to make sure the agent knows it should use this policy file and bun ```json { - "inputs": [ "services/ntp.cf" ], - "vars": { - "control_common_bundlesequence_end": [ "ntp" ] - } + "inputs": ["services/ntp.cf"], + "vars": { "control_common_bundlesequence_end": ["ntp"] } } ``` @@ -266,7 +263,6 @@ After making changes it's always a good idea to validate the policy file you mod If the code has no syntax error, you should see no output. - Perform a manual policy run and review the output to ensure that the policy executed successfully. Upon a successful run you should expect to see an output similar to this (depending on the init system your OS is using): ```command @@ -291,7 +287,6 @@ Now we will manage the configuration file using the built-in mustache templating By default, the NTP service leverages configuration properties specified in /etc/ntp.conf. In this tutorial, we introduce the concept of the files promise type. With this promise type, you can create, delete, and edit files using CFEngine policies. The example policy below illustrates the use of the files promise. - ```cf3 bundle agent ntp { @@ -349,7 +344,6 @@ keys /etc/ntp/keys service_policy => "restart", classes => results( "bundle", "ntp_service_config_change" ); - reports: ntp_service_running_repaired.inform_mode:: "NTP service started"; @@ -360,14 +354,12 @@ keys /etc/ntp/keys } ``` - What does this policy do? Let's review the different sections of the code, starting with the variable declarations which makes use of operating system environment for classification of the time servers. #### vars - ```cf3 vars: linux:: @@ -392,7 +384,6 @@ keys /etc/ntp/keys "; ``` - A few new variables are defined. The variables `ntp_package_name`, `config_file`, `driftfile`, `servers`, and `config_template_string` are defined under the `linux` context (so only linux hosts will define them). `config_file` is the path to the ntp configuration file, `driftfile` and `servers` are both variables that will be used when rendering the configuration file and `config_template_string` is the template that will be used to render the configuration file. While both `driftfile` and `servers` are set the same for all linux hosts, those variables could easily be set to different values under different contexts. #### files @@ -474,7 +465,7 @@ Note, `mergedata()` tries to expand bare values from CFEngine variables, so `ser ```json { "driftfile": "/var/lib/ntp/drift", - "servers": [ "time.nist.gov" ] + "servers": ["time.nist.gov"] } ``` @@ -521,7 +512,6 @@ Next we will augment file/template management with data sourced from a JSON data CFEngine offers out-of-the-box support for reading and writing JSON data structures. In this tutorial, we will default the NTP configuration properties in policy, but provide a path for the properties to be overridden from Augments. - ```cf3 {file="ntp.cf"} bundle agent ntp { @@ -595,7 +585,6 @@ keys /etc/ntp/keys service_policy => "restart", classes => results( "bundle", "ntp_service_config_change" ); - reports: ntp_service_running_repaired.inform_mode:: "NTP service started"; @@ -606,7 +595,6 @@ keys /etc/ntp/keys } ``` - What does this policy do? Let's review the changes to the vars promises as they were the only changes made. @@ -646,7 +634,6 @@ Notice two promises were introduced, one setting `driftfile` to the value of `$( First modify `services/ntp.cf` as shown previously (don't forget to check syntax with `cf-promises` after modification), then run the policy. - ```command cf-agent -KIf update.cf ``` @@ -667,14 +654,18 @@ Modify `def.json` so that it looks like this: ```json {file="def.json"} { - "inputs": [ "services/ntp.cf" ], + "inputs": ["services/ntp.cf"], "vars": { - "control_common_bundlesequence_end": [ "ntp" ], + "control_common_bundlesequence_end": ["ntp"], "ntp": { "config": { "driftfile": "/tmp/drift", - "servers": [ "0.north-america.pool.ntp.org", "1.north-america.pool.ntp.org", - "2.north-america.pool.ntp.org", "3.north-america.pool.ntp.org" ] + "servers": [ + "0.north-america.pool.ntp.org", + "1.north-america.pool.ntp.org", + "2.north-america.pool.ntp.org", + "3.north-america.pool.ntp.org" + ] } } } @@ -683,7 +674,6 @@ Modify `def.json` so that it looks like this: Now, let's validate the JSON and force a policy run and inspect the result. - ```command python -m json.tool < def.json ``` diff --git a/content/examples/tutorials/manage-packages.markdown b/content/examples/tutorials/manage-packages.markdown index 3701c4b12..195c2e674 100644 --- a/content/examples/tutorials/manage-packages.markdown +++ b/content/examples/tutorials/manage-packages.markdown @@ -142,10 +142,8 @@ declaration, and `manage_packages` to the bundlesequence declaration. ```json {file="def.json"} { - "inputs": [ "manage_packages.cf" ], - "vars": { - "control_common_update_bundlesequence_end": [ "manage_packages" ] - } + "inputs": ["manage_packages.cf"], + "vars": { "control_common_update_bundlesequence_end": ["manage_packages"] } } ``` diff --git a/content/examples/tutorials/masterfiles_policy_framework_upgrade.markdown b/content/examples/tutorials/masterfiles_policy_framework_upgrade.markdown index 5dab88318..5f100bc16 100644 --- a/content/examples/tutorials/masterfiles_policy_framework_upgrade.markdown +++ b/content/examples/tutorials/masterfiles_policy_framework_upgrade.markdown @@ -8,16 +8,10 @@ Upgrading the Masterfiles Policy Framework (MPF) is the first step in upgrading Upgrading the MPF is not an exact process as the details highly depend on the specifics of the changes made to the default policy. This example leverages `git` and shows an example of upgrading a simple policy set based on `3.18.0` to `3.21.2` and can be used as a reference for upgrading your own policy sets. - - - # Prepare a Git clone of your working masterfiles We will perform the integration work in `/tmp/MPF-upgrade/integration`. `masterfiles` should exist in the integration directory and is expected to be both the root of your policy set and a `git` repository. - - - ## Validating expectations From `/tmp/MPF-upgrade/integration/masterfiles`. Let's inspect what we expect. @@ -67,14 +61,8 @@ Date: Wed Jul 26 18:43:06 2023 -0500 CFEngine Policy set prior to upgrade ``` - - - # Merge upstream changes from the MPF into your policy - - - ## Remove everything except the `.git` directory By first removing everything we will easily be able so see which files are **new**, **changed**, **moved** or **removed** upstream. @@ -225,14 +213,8 @@ Changes not staged for commit: no changes added to commit (use "git add" and/or "git commit -a") ``` - - - ## Install the new version of the MPF - - - ### Installing from Git First, clone the desired version of the MPF source. @@ -412,9 +394,6 @@ cd $INTEGRATION_ROOT/ rm -rf $INTEGRATION_ROOT/masterfiles-source-$MPF_VERSION ``` - - - ## Merge differences Now we can use `git status` to see an overview of the changes to the repository between our starting point and the new MPF. @@ -797,7 +776,6 @@ index 15c0c40..4611098 100644 @@ -127,6 +115,12 @@ custom_2, ignore_missing_inputs => "$(def.control_common_ignore_missing_inputs)"; - + control_common_tls_min_version_defined:: + tls_min_version => "$(default:def.control_common_tls_min_version)"; # See also: allowtlsversion in body server control + diff --git a/content/examples/tutorials/render-files-with-mustache-templates.markdown b/content/examples/tutorials/render-files-with-mustache-templates.markdown index c41944464..ccac0e57a 100644 --- a/content/examples/tutorials/render-files-with-mustache-templates.markdown +++ b/content/examples/tutorials/render-files-with-mustache-templates.markdown @@ -41,9 +41,7 @@ Allowed users {{#users}}
Create a file called `/tmp/myapp.conf.template` with the following content: -``` -[file=myapp.conf.template] - +```{file="/tmp/myapp.conf.template"} Port {{port}} Protocol {{protocol}} Filepath {{filepath}} diff --git a/content/examples/tutorials/reporting/command-line-reports.markdown b/content/examples/tutorials/reporting/command-line-reports.markdown index 888d0d2a1..e840ca1f7 100644 --- a/content/examples/tutorials/reporting/command-line-reports.markdown +++ b/content/examples/tutorials/reporting/command-line-reports.markdown @@ -24,7 +24,6 @@ The following report topics are included: [Change detection: tripwires][Command-Line reports#Change detection: tripwires] - ### CFEngine output levels CFEngine's default behavior is to report to the console (known as standard output). It's @@ -386,7 +385,6 @@ body common control bundlesequence => { "one" }; } - bundle agent one { files: diff --git a/content/examples/tutorials/write-cfengine-policy.markdown b/content/examples/tutorials/write-cfengine-policy.markdown index 6539c8fce..43e471ab9 100644 --- a/content/examples/tutorials/write-cfengine-policy.markdown +++ b/content/examples/tutorials/write-cfengine-policy.markdown @@ -166,7 +166,7 @@ Now we need to tell CFEngine that there is a new policy in town: ```json {file="def.json"} { - "inputs": [ "my-policy.cf" ] + "inputs": ["my-policy.cf"] } ``` diff --git a/content/examples/tutorials/writing-and-serving-policy/_index.markdown b/content/examples/tutorials/writing-and-serving-policy/_index.markdown index 26c683e5f..93c2e92b5 100644 --- a/content/examples/tutorials/writing-and-serving-policy/_index.markdown +++ b/content/examples/tutorials/writing-and-serving-policy/_index.markdown @@ -104,6 +104,5 @@ needless fragility and keep two independent quality assurance processes apart. * [Testing policies][Testing policies] This page describes how to locally test CFEngine and play with configuration files. - ## See also * [Promises][Promises] diff --git a/content/examples/tutorials/writing-and-serving-policy/authoring-policy-tools-and-workflow.markdown b/content/examples/tutorials/writing-and-serving-policy/authoring-policy-tools-and-workflow.markdown index 7f03bea19..cc9d62b4f 100644 --- a/content/examples/tutorials/writing-and-serving-policy/authoring-policy-tools-and-workflow.markdown +++ b/content/examples/tutorials/writing-and-serving-policy/authoring-policy-tools-and-workflow.markdown @@ -45,7 +45,6 @@ Method Two: Create Masterfiles Repository Using the GitHub Application 4. Select one of your "Accounts" where you want the new repository to be created. 5. Click on the "Create" button at the bottom of the screen. A new repository will be created in your local GitHub folder. - #### Initialize Git Repository in Masterfiles on the Hub ```bash cd /var/cfengine/masterfiles diff --git a/content/examples/tutorials/writing-and-serving-policy/policy-style.markdown b/content/examples/tutorials/writing-and-serving-policy/policy-style.markdown index f00139e1b..5268d4c7e 100644 --- a/content/examples/tutorials/writing-and-serving-policy/policy-style.markdown +++ b/content/examples/tutorials/writing-and-serving-policy/policy-style.markdown @@ -97,7 +97,6 @@ bundle agent main policy => "present"; package_module => apt_get; - files: "$(sshd_config)" @@ -278,7 +277,6 @@ consider when your policy should generate report output. For policy degbugging type information (value of variables, classes that were set or not) the following style is recommended: - ```cf3 bundle agent example { @@ -385,7 +383,6 @@ Naming conventions can also help to provide clarity. Words delimited by an underscore. This style is prevalant for *variables*, *classes*, *bundle* and *body* names in the Masterfiles Policy Framework. - [%CFEngine_include_example(style_snake_case.cf)%] ### Pascalecase @@ -407,7 +404,6 @@ help improve the readability of policy, especially when working with lists and data containers where the use of `@` or `$` significantly affects the behavior of the policy. - [%CFEngine_include_example(style_hungarian.cf)%] ## Classes diff --git a/content/examples/tutorials/writing-and-serving-policy/testing-policies.markdown b/content/examples/tutorials/writing-and-serving-policy/testing-policies.markdown index 1458db355..68a11d4ae 100644 --- a/content/examples/tutorials/writing-and-serving-policy/testing-policies.markdown +++ b/content/examples/tutorials/writing-and-serving-policy/testing-policies.markdown @@ -36,7 +36,6 @@ following: ~/.cfagent/bin/cf-promises --verbose ``` - This is always the way to start checking a configuration in CFEngine 3. If a configuration does not pass this check/test, you will not be allowed to use it, and `cf-agent` will look for the file `failsafe.cf`. diff --git a/content/getting-started/installation/general-installation/_index.markdown b/content/getting-started/installation/general-installation/_index.markdown index fb4d609ca..62b6d1982 100644 --- a/content/getting-started/installation/general-installation/_index.markdown +++ b/content/getting-started/installation/general-installation/_index.markdown @@ -46,19 +46,16 @@ Run the bootstrap command, **first** on the policy server: 1. Find the IP address of your Policy Server: - ```command ifconfig ``` - 2. Run the bootstrap command: ```command sudo /var/cfengine/bin/cf-agent --bootstrap ``` - The bootstrap command must then be run on any client attaching itself to this server, using the ip address of the policy server (i.e. exactly the same as the command run on the policy server itself). ## Post-installation configuration @@ -67,7 +64,6 @@ CFEngine itself is configured through policy as well (see [Components][] and [Masterfiles Policy Framework][] for details). The following basic changes to the default policy will configure `cf-serverd` and `cf-execd` for your environment. - ### Configure agent email settings By default an email a summary of any `cf-agent` run initiated by `cf-execd`. You @@ -106,9 +102,7 @@ The preferred way to disable the agent from sending emails is to define ```json {file="def.json"} { - "classes": { - "cfengine_internal_disable_agent_email": [ "any" ] - } + "classes": { "cfengine_internal_disable_agent_email": ["any"] } } ``` @@ -125,7 +119,6 @@ Edit `/etc/hosts` and add an entry for the IP address and hostname of the server See: [What steps should I take after installing CFEngine Enterprise?][FAQ#What steps should I take after installing CFEngine Enterprise] - ## More detailed installation guides Although most install procedures follow the same general workflow, there are several ways of installing CFEngine depending on your environment and which version of CFEngine you are using. diff --git a/content/getting-started/installation/general-installation/installation-community-containerized.markdown b/content/getting-started/installation/general-installation/installation-community-containerized.markdown index c0e9df6e5..e0bbcbc76 100644 --- a/content/getting-started/installation/general-installation/installation-community-containerized.markdown +++ b/content/getting-started/installation/general-installation/installation-community-containerized.markdown @@ -13,7 +13,6 @@ Docker containers will be created, one container to be the Policy Server (server Both the containers will run **_ubi9-init_** images and communicate on a container network. Upon completion, you are ready to start working with CFEngine. - ## Requirements * 1G+ disk space * 1G+ memory diff --git a/content/getting-started/installation/general-installation/installation-community.markdown b/content/getting-started/installation/general-installation/installation-community.markdown index 850d66a26..bbf99e516 100644 --- a/content/getting-started/installation/general-installation/installation-community.markdown +++ b/content/getting-started/installation/general-installation/installation-community.markdown @@ -94,7 +94,6 @@ sudo dpkg -i cfengine-community_{{site.cfengine.branch}}.{{site.cfengine.latest_ **Note:** You might get a message like this: "Policy is not found in /var/cfengine/inputs, not starting CFEngine." Do not worry; this is taken care of during the bootstrapping process. - ## 3. Bootstrap the policy server The Policy Server must be bootstrapped to itself. Find the IP address of your Policy Server. diff --git a/content/getting-started/installation/general-installation/installation-enterprise-free-aws-rhel.markdown b/content/getting-started/installation/general-installation/installation-enterprise-free-aws-rhel.markdown index 7e57de0de..b16cea6a4 100644 --- a/content/getting-started/installation/general-installation/installation-enterprise-free-aws-rhel.markdown +++ b/content/getting-started/installation/general-installation/installation-enterprise-free-aws-rhel.markdown @@ -98,7 +98,6 @@ The following steps are only necessary for one of the two virtual machines, the The `Port and Protocol` are entered in the blue boxes, with entries of `5308` and `tcp` respectively. Then the `Tab` key is used to highlight the `OK` button, and the user presses `Enter`. - #### Wrapping up firewall configuration * Hit the `Tab` key until `Close` is highlighted, and hit `Enter`. diff --git a/content/getting-started/installation/general-installation/installation-enterprise-free.markdown b/content/getting-started/installation/general-installation/installation-enterprise-free.markdown index 188da2165..014ef87b0 100644 --- a/content/getting-started/installation/general-installation/installation-enterprise-free.markdown +++ b/content/getting-started/installation/general-installation/installation-enterprise-free.markdown @@ -32,7 +32,6 @@ Bootstrapping completes the installation process. the actual state of all your Hosts, thus ensuring that your promises are being executed. * **Try out the Tutorials.** Links to three tutorials give you a head start on learning CFEngine. - ## 1. Download and install Enterprise on a policy server Please Note: Internet access is required from the host if you wish to use the quick install script. diff --git a/content/getting-started/installation/general-installation/installation-enterprise.markdown b/content/getting-started/installation/general-installation/installation-enterprise.markdown index 192376766..e98050a84 100644 --- a/content/getting-started/installation/general-installation/installation-enterprise.markdown +++ b/content/getting-started/installation/general-installation/installation-enterprise.markdown @@ -161,7 +161,6 @@ The maximum number of connections is the maximum number of sessions that remote agents bootstrapped to your policy server, 200 would be a good value body server control maxconnections. - ### Open file descriptors Open file descriptors should be set at least **two times body server control @@ -197,7 +196,6 @@ Server (hub) and the other is for each Host (client). **Log in as root** and then follow these steps to install CFEngine Enterprise: - 1. On the designated Policy Server, install the `cfengine-nova-hub` package: ```console diff --git a/content/getting-started/installation/pre-installation-checklist/verify-signatures.markdown b/content/getting-started/installation/pre-installation-checklist/verify-signatures.markdown index fcc1b1140..8867fe5e0 100644 --- a/content/getting-started/installation/pre-installation-checklist/verify-signatures.markdown +++ b/content/getting-started/installation/pre-installation-checklist/verify-signatures.markdown @@ -11,7 +11,6 @@ sha256 checksums of all downloadable files which you can verify by using In addition to this, `*.deb` and `*.rpm` packages (with the exception of AIX rpms) are cryptographically signed using gpg. - ## Validating signature of RPM NOTE: AIX rpms currently are NOT signed because it's not supported on older versions of AIX. diff --git a/content/getting-started/installation/pre-installation-checklist/vi-quick-start-guide.markdown b/content/getting-started/installation/pre-installation-checklist/vi-quick-start-guide.markdown index 9e4a32ba0..69e177d1b 100644 --- a/content/getting-started/installation/pre-installation-checklist/vi-quick-start-guide.markdown +++ b/content/getting-started/installation/pre-installation-checklist/vi-quick-start-guide.markdown @@ -4,7 +4,6 @@ title: Quick-Start guide to using vi sorting: 1 --- - This guide is designed for the novice user of CFEngine tutorials-and will introduce the basic use of a powerful tool that is referenced in the CFEngine learning documentation: the vi visual editor. diff --git a/content/getting-started/installation/secure-bootstrap.markdown b/content/getting-started/installation/secure-bootstrap.markdown index 573b7b324..e02ad92e9 100644 --- a/content/getting-started/installation/secure-bootstrap.markdown +++ b/content/getting-started/installation/secure-bootstrap.markdown @@ -41,9 +41,7 @@ In order to specify and limit which hosts (IP addresses) are considered trusted ```json {file="/var/cfengine/masterfiles/def.json"} { - "variables": { - "default:def.acl": ["192.0.2.42", "198.51.100.7"] - } + "variables": { "default:def.acl": ["192.0.2.42", "198.51.100.7"] } } ``` @@ -77,9 +75,7 @@ You can edit the augments file to achieve this: ```json {file="/var/cfengine/masterfiles/def.json"} { - "variables": { - "default:def.trustkeysfrom": [] - } + "variables": { "default:def.trustkeysfrom": [] } } ``` diff --git a/content/getting-started/installation/upgrading.markdown b/content/getting-started/installation/upgrading.markdown index 99c87240d..aeeec0ccb 100644 --- a/content/getting-started/installation/upgrading.markdown +++ b/content/getting-started/installation/upgrading.markdown @@ -180,13 +180,13 @@ empty before performing an Enterprise Hub binary upgrade. ```json { - "classes": { + "classes": { "trigger_upgrade": [ "ipv4_192_0_2", "ipv4_203_0_13", - "cfengine_3_10_(?!2$)\d+" + "cfengine_3_10_(?!2$)\\d+" ] - } + } } ``` diff --git a/content/guide/_index.markdown b/content/guide/_index.markdown index 58e729e92..7533d7aa4 100644 --- a/content/guide/_index.markdown +++ b/content/guide/_index.markdown @@ -53,7 +53,6 @@ Take a look at the [Getting started][] section to learn more about CFEngine's ar Check out [External resources][External resources], for more guides, demos, and other resources from our CFEngine staff and our special CFEngine contributors. - ## Use our help [Support and community][External Resources#Support and community] We provide a number of ways to connect you to CFEngine diff --git a/content/overview/client-server-communication.markdown b/content/overview/client-server-communication.markdown index 2bd1efc15..f2b55f90c 100644 --- a/content/overview/client-server-communication.markdown +++ b/content/overview/client-server-communication.markdown @@ -180,7 +180,6 @@ other users are to be granted access to the system, they must also generate a key and go through the same process. In addition, the users must be added to the server configuration file. - ## Encryption CFEngine has 2 communication protocols. `classic` or `1` and `2` or `latest`. diff --git a/content/overview/directory-structure.markdown b/content/overview/directory-structure.markdown index 344b2f8e9..43a4a4a85 100644 --- a/content/overview/directory-structure.markdown +++ b/content/overview/directory-structure.markdown @@ -265,7 +265,6 @@ If an interface matches a regular expression in the file then various classes an * `bin/reindexdb` * `bin/vacuumdb` - ## Not verified * `state/history.lmdb` diff --git a/content/overview/how-cfengine-works.markdown b/content/overview/how-cfengine-works.markdown index f7b731063..9f391f10d 100644 --- a/content/overview/how-cfengine-works.markdown +++ b/content/overview/how-cfengine-works.markdown @@ -218,7 +218,6 @@ The four mission phases are sometimes referred to as [Contact CFEngine](https://cfengine.com/contact) - ## CFEngine architecture and design CFEngine operates autonomously in a network, under your guidance. While CFEngine supports anything from 1 servers to 100,000+ servers, the essence of diff --git a/content/overview/what-is-cfengine-and-why.markdown b/content/overview/what-is-cfengine-and-why.markdown index 3fe41cd6f..1256a88aa 100644 --- a/content/overview/what-is-cfengine-and-why.markdown +++ b/content/overview/what-is-cfengine-and-why.markdown @@ -22,5 +22,4 @@ Many DevOps organizations use CFEngine to ensure consistency across different st - Mark Burgess, Founder and author of CFEngine talks about the reasons CFEngine is a Configuration Management system for the century. diff --git a/content/reference/components/_index.markdown b/content/reference/components/_index.markdown index b64183a6e..fa778bf07 100644 --- a/content/reference/components/_index.markdown +++ b/content/reference/components/_index.markdown @@ -23,7 +23,6 @@ The `common` control body refers to those promises that are hard-coded into all the components of CFEngine, and therefore affect the behavior of all the components. - ```cf3 body common control @@ -47,7 +46,6 @@ version => "1.2.3"; } ``` - ### bundlesequence **Description:** The `bundlesequence` contains promise bundles @@ -57,7 +55,6 @@ The `bundlesequence` determines which of the compiled bundles will be executed by `cf-agent` and in what order they will be executed. The list refers to the names of bundles (which might be parameterized, function-like objects). - The default value for `bundlesequence` is `{ "main" }`. A `bundlesequence` may also be specified using the `-b` or @@ -164,7 +161,6 @@ body common control In this example, bwlimit is set to 10MBytes/sec = 80Mbit/s meaning that CFEngine would only consume up to ~80% of any 100Mbit ethernet interface. - ### cache_system_functions **Description:** Controls the caching of the results of system @@ -196,7 +192,6 @@ cache_system_functions => "true"; **History:** - Introduced in version 3.6.0. - ### domain **Description:** The `domain` string specifies the domain name for this host. @@ -218,7 +213,6 @@ domain => "example.org"; } ``` - ### goal_patterns **Description:** Contains regular expressions that match promisees/topics @@ -243,7 +237,6 @@ goal_patterns => { "goal_.*", "target.*" }; **History:** Was introduced in version 3.1.5, Nova 2.1.0 (2011) - ### ignore_missing_bundles **Description:** Determines whether to ignore missing bundles. @@ -268,7 +261,6 @@ This authorizes the bundlesequence to contain possibly undefined bundles cause a fatal error in parsing, and a transition to failsafe mode. - ### ignore_missing_inputs **Description:** If any input files do not exist, ignore and continue @@ -468,7 +460,6 @@ require_comments => "true"; } ``` - ### site_classes **Description:** A `site_classes` contains classes that will represent @@ -499,7 +490,6 @@ site_classes => { "datacenters","datacentres" }; # locations is by default **History:** Was introduced in version 3.2.0, Nova 2.1.0 (2011) - ### syslog_host **Description:** The `syslog_host` contains the name or address of a @@ -641,7 +631,6 @@ version => "1.2.3"; } ``` - ## Deprecated attributes in body common control The following attributes were functional in previous versions diff --git a/content/reference/components/cf-execd.markdown b/content/reference/components/cf-execd.markdown index c298dc71e..692da6cde 100644 --- a/content/reference/components/cf-execd.markdown +++ b/content/reference/components/cf-execd.markdown @@ -21,7 +21,6 @@ network. * This daemon reloads it's config when the SIGHUP signal is received. * `cf-execd` always considers the class ```executor``` to be defined. - **History:** - SIGHUP behavior added in 3.7.0 @@ -46,7 +45,6 @@ body executor control } ``` - ### agent_expireafter **Description:** Maximum agent runtime (in minutes) @@ -83,7 +81,6 @@ number of simultaneous agents that are running. For example, if you set it to `120` and you are using a 5-minute agent schedule, a maximum of 120 / 5 = 24 agents should be enforced. - **See also:** [`body action expireafter`][Promise types#expireafter], [`body contain exec_timeout`][commands#exec_timeout], [`body agent control expireafter`][cf-agent#expireafter] ### executorfacility diff --git a/content/reference/components/cf-hub.markdown b/content/reference/components/cf-hub.markdown index ee4b01db2..18ab72832 100644 --- a/content/reference/components/cf-hub.markdown +++ b/content/reference/components/cf-hub.markdown @@ -167,7 +167,6 @@ change in the future. Changing the standard port number is not recommended practice. You should not do it without a good reason. - ### client_history_timeout **Description:** If the hub can't reach a client for this many (or more) hours, diff --git a/content/reference/components/cf-monitord.markdown b/content/reference/components/cf-monitord.markdown index 107de3030..f82c681f5 100644 --- a/content/reference/components/cf-monitord.markdown +++ b/content/reference/components/cf-monitord.markdown @@ -162,7 +162,6 @@ made by `cf-monitord`. The system defaults will be sufficient for most users. This configurability potential, however, will be a key to developing the integrated monitoring capabilities of CFEngine. - ```cf3 body monitor control { @@ -174,7 +173,6 @@ body monitor control } ``` - ### forgetrate **Description:** Decimal fraction [0,1] weighting of new values over @@ -209,7 +207,6 @@ option is a no-op kept for backward compatibility. It used to cause CFEngine to learn the conformally transformed distributions of fluctuations about the mean. - **Type:** [`boolean`][boolean] **Default value:** true diff --git a/content/reference/components/cf-runagent.markdown b/content/reference/components/cf-runagent.markdown index 6d044b508..58fbd58ed 100644 --- a/content/reference/components/cf-runagent.markdown +++ b/content/reference/components/cf-runagent.markdown @@ -111,7 +111,6 @@ this could change in the future. Changing the standard port number is not recommended practice. You should not do it without a good reason. - ### force_ipv4 **Description:** true/false force use of ipv4 in connection diff --git a/content/reference/components/cf-serverd.markdown b/content/reference/components/cf-serverd.markdown index f1b89b391..f412c5c22 100644 --- a/content/reference/components/cf-serverd.markdown +++ b/content/reference/components/cf-serverd.markdown @@ -51,7 +51,6 @@ body server control } ``` - ### allowconnects **Description:** List of IP addresses that may connect to the @@ -79,7 +78,6 @@ allowconnects => { }; ``` - ### allowallconnects **Description:** List of IP addresses that may have more than one @@ -112,7 +110,6 @@ allowallconnects => { }; ``` - ### allowlegacyconnects **Description:** List of hosts from which the server accepts connections @@ -141,7 +138,6 @@ specify a list of hosts allowed to use the legacy protocol. **See also:** [`protocol_version`][Components#protocol_version] - ### allowciphers **Description:** List of TLS ciphers the server accepts both **incoming** and **outgoing** (in the case of client initiated reporting with CFEngine Enterprise) connections using `cf-serverd`. @@ -174,7 +170,6 @@ this does not do anything as the classic protocol does not support TLS ciphers. **History:** Introduced in CFEngine 3.6.0 - ### allowtlsversion **Description:** Minimum TLS version allowed for both **incoming** and **outgoing** (in the case of client initiated reporting with CFEngine Enterprise) connections using `cf-serverd`. @@ -206,7 +201,6 @@ this attribute does not do anything. **History:** Introduced in CFEngine 3.7.0 - ### allowusers **Description:** List of usernames who may execute requests from this @@ -226,7 +220,6 @@ correspond to system identities on the server-side system. allowusers => { "cfengine", "root" }; ``` - ### bindtointerface **Description:** IP of the interface to which the server should bind @@ -263,7 +256,6 @@ Connection to fe80:470:1d:a2f::2 5308 port [tcp/cfengine] succeeded! ^C ``` - ### cfruncommand **Description:** Path to the cf-agent command or cf-execd wrapper for @@ -277,7 +269,6 @@ shell command at your own risk. **Allowed input range:** `.+` - ```cf3 body server control { @@ -393,7 +384,6 @@ bundle server my_access_rules() **History:** Was introduced in Enterprise 3.0.0 (2012) - ### collect_window **CFEngine Enterprise only.** @@ -411,7 +401,6 @@ open to a hub to attempt a report transfer before it is closed **History:** Was introduced in Enterprise 3.0.0 (2012) - ### denybadclocks **Description:** true/false accept connections from hosts with clocks @@ -438,7 +427,6 @@ denybadclocks => "true"; } ``` - ### denyconnects **Description:** List of IPs that may NOT connect to the @@ -468,7 +456,6 @@ denyconnects => { "badhost\.domain\.evil", "host3\.domain\.com" }; } ``` - ### logallconnections **Deprecated: This attribute was deprecated in 3.7.0.** @@ -498,7 +485,6 @@ logencryptedtransfers => "true"; **See also:** [`ifencrypted`][access#ifencrypted], [`encrypt`][files#encrypt], [`tls_ciphers`][Components#tls_ciphers], [`tls_min_version`][Components#tls_min_version], [`allowciphers`][cf-serverd#allowciphers], [`allowtlsversion`][cf-serverd#allowtlsversion], [`protocol_version`][Components#protocol_version] - ### maxconnections **Description:** Maximum number of concurrent connections the server @@ -529,7 +515,6 @@ maxconnections => "1000"; } ``` - ### port **Description:** Default port for the CFEngine server @@ -599,7 +584,6 @@ serverfacility => "LOG_USER"; } ``` - ### skipverify **Description:** This option is obsolete, does nothing and is retained @@ -618,7 +602,6 @@ skipverify => { "special_host.*", "192.168\..*" }; } ``` - ### trustkeysfrom **Description:** List of IPs from whom the server will accept and trust @@ -653,7 +636,6 @@ trustkeysfrom => { "10.0.1.1", "192.168.0.0/16"}; } ``` - ### listen **Description:** true/false enable server daemon to listen on defined @@ -686,7 +668,6 @@ body server control **History:** Was introduced in 3.4.0, Enterprise 3.0 (2012) - ## Deprecated attributes in body server control The following attributes were functional in previous versions diff --git a/content/reference/components/file_control_promises.markdown b/content/reference/components/file_control_promises.markdown index 8e8fac196..cffbb3a7f 100644 --- a/content/reference/components/file_control_promises.markdown +++ b/content/reference/components/file_control_promises.markdown @@ -4,7 +4,6 @@ title: file control sorting: 100 --- - ```cf3 body file control { @@ -72,7 +71,6 @@ $ cf-agent -KIf ./one.cf R: hello, from /home/agent/./two.cf ``` - **See also:** [`inputs`][Components#inputs] in [`body common control`][Components] diff --git a/content/reference/functions/accumulated.markdown b/content/reference/functions/accumulated.markdown index 417e7a6a9..36df83b16 100644 --- a/content/reference/functions/accumulated.markdown +++ b/content/reference/functions/accumulated.markdown @@ -13,7 +13,6 @@ days, 27 hours and 90 minutes of runtime" ". However, you are strongly encouraged to keep your usage of `accumulated` sensible and readable; for example, `accumulated(0,0,0,48,0,0)` or `accumulated(0,0,0,0,90,0)`. - **Arguments:** * `years`, in the range `0,1000` diff --git a/content/reference/functions/canonify.markdown b/content/reference/functions/canonify.markdown index 8af1098c8..2ecf4ce1a 100644 --- a/content/reference/functions/canonify.markdown +++ b/content/reference/functions/canonify.markdown @@ -13,7 +13,6 @@ This function turns arbitrary text into class data. **Example:** - [%CFEngine_include_snippet(canonify.cf, #\+begin_src cfengine3, .*end_src)%] Output: diff --git a/content/reference/functions/canonifyuniquely.markdown b/content/reference/functions/canonifyuniquely.markdown index 52e5f35c3..ec0ec7d4d 100644 --- a/content/reference/functions/canonifyuniquely.markdown +++ b/content/reference/functions/canonifyuniquely.markdown @@ -20,7 +20,6 @@ a list, but files in the list may have the same name when **Example:** - ```cf3 commands: diff --git a/content/reference/functions/classesmatching.markdown b/content/reference/functions/classesmatching.markdown index c81b33fc7..2b9716630 100644 --- a/content/reference/functions/classesmatching.markdown +++ b/content/reference/functions/classesmatching.markdown @@ -23,7 +23,6 @@ If no classes match `name` and any tags given then an empty list is returned. **Example:** - [%CFEngine_include_snippet(classesmatching.cf, #\+begin_src cfengine3, .*end_src)%] Output: diff --git a/content/reference/functions/escape.markdown b/content/reference/functions/escape.markdown index 934e196dc..4fe4c5674 100644 --- a/content/reference/functions/escape.markdown +++ b/content/reference/functions/escape.markdown @@ -16,7 +16,6 @@ characters, so that you do not have to. **Example:** - [%CFEngine_include_snippet(escape.cf, #\+begin_src cfengine3, .*end_src)%] Output: diff --git a/content/reference/functions/filter.markdown b/content/reference/functions/filter.markdown index 21595c051..50206de54 100644 --- a/content/reference/functions/filter.markdown +++ b/content/reference/functions/filter.markdown @@ -30,7 +30,6 @@ Invert filter. **Example:** - [%CFEngine_include_snippet(filter.cf, #\+begin_src cfengine3, .*end_src)%] Output: diff --git a/content/reference/functions/findlocalusers.markdown b/content/reference/functions/findlocalusers.markdown index 0708fcd64..eb74b0d7f 100644 --- a/content/reference/functions/findlocalusers.markdown +++ b/content/reference/functions/findlocalusers.markdown @@ -19,8 +19,6 @@ The possible attributes are: * `dir`: path to home directory * `shell`: default shell - - **Example:** [%CFEngine_include_snippet(findlocalusers.cf, #\+begin_src cfengine3, .*end_src)%] diff --git a/content/reference/functions/hubknowledge.markdown b/content/reference/functions/hubknowledge.markdown index 1d3858207..4ab884f0f 100644 --- a/content/reference/functions/hubknowledge.markdown +++ b/content/reference/functions/hubknowledge.markdown @@ -27,7 +27,6 @@ a CFEngine system back to the client machines. The data available through this channel are generated automatically by discovery, unlike `remotescalar` which accesses user defined data. - [%CFEngine_function_attributes(id)%] **Example:** diff --git a/content/reference/functions/mapdata.markdown b/content/reference/functions/mapdata.markdown index 4f713ca33..8f1f46360 100644 --- a/content/reference/functions/mapdata.markdown +++ b/content/reference/functions/mapdata.markdown @@ -58,7 +58,6 @@ Output: [%CFEngine_include_snippet(mapdata_jsonpipe.cf, #\+begin_src\s+output\s*, .*end_src)%] - **History:** Was introduced in 3.7.0. `canonify` mode was introduced in 3.9.0. The [collecting function][Functions#collecting functions] behavior was added in 3.9. The `json_pipe` mode was added in 3.9. The delayed evaluation behavior was introduced in 3.10. **See also:** `maplist()`, `maparray()`, `canonify()`, [about collecting functions][Functions#collecting functions], and `data` documentation. diff --git a/content/reference/functions/packagesmatching.markdown b/content/reference/functions/packagesmatching.markdown index 21cd99532..290794bbc 100644 --- a/content/reference/functions/packagesmatching.markdown +++ b/content/reference/functions/packagesmatching.markdown @@ -16,12 +16,12 @@ this: ```json [ - { - "arch":"default", - "method":"dpkg", - "name":"zsh-common", - "version":"5.0.7-5ubuntu1" - } + { + "arch": "default", + "method": "dpkg", + "name": "zsh-common", + "version": "5.0.7-5ubuntu1" + } ] ``` @@ -41,7 +41,6 @@ At no time will both the standard and the legacy data be available to these func The following code extracts just the package names, then looks for some desired packages, and finally reports if they are installed. - [%CFEngine_include_example(packagesmatching.cf)%] **Refresh rules:** @@ -62,7 +61,6 @@ Or in the case of legacy package methods: $(sys.statedir)/software_packages.csv ``` - **History:** * Introduced in CFEngine 3.6 @@ -70,5 +68,4 @@ $(sys.statedir)/software_packages.csv there is no `package_inventory` attribute defined in `body common control` if available in 3.23.0 - **See also:** `packageupdatesmatching()`, [Package information cache tunables in the MPF][Masterfiles Policy Framework#Configure periodic package inventory refresh interval] diff --git a/content/reference/functions/packageupdatesmatching.markdown b/content/reference/functions/packageupdatesmatching.markdown index cf023cff5..e656df5ea 100644 --- a/content/reference/functions/packageupdatesmatching.markdown +++ b/content/reference/functions/packageupdatesmatching.markdown @@ -16,12 +16,12 @@ this: ```json [ - { - "arch":"default", - "method":"dpkg", - "name":"syncthing", - "version":"0.12.8" - } + { + "arch": "default", + "method": "dpkg", + "name": "syncthing", + "version": "0.12.8" + } ] ``` @@ -36,7 +36,6 @@ This enables the usage of these policy functions in standalone policy files. But If there is no `package_inventory` attribute (such as on package module unsupported platforms) and there are no software inventory databases available in `$(sys.statedir)` then the legacy package methods data will be used instead. At no time will both the standard and the legacy data be available to these functions simultaneously. - **Example:** ```cf3 @@ -73,5 +72,4 @@ $(sys.statedir)/software_patches_avail.csv there is no `package_inventory` attribute defined in `body common control` if available in 3.23.0 - **See also:** `packagesmatching()`, [Package information cache tunables in the MPF][Masterfiles Policy Framework#Configure periodic package inventory refresh interval] diff --git a/content/reference/functions/readintlist.markdown b/content/reference/functions/readintlist.markdown index b4ccc1cf1..a719c5d70 100644 --- a/content/reference/functions/readintlist.markdown +++ b/content/reference/functions/readintlist.markdown @@ -28,5 +28,4 @@ Output: [%CFEngine_include_snippet(readintlist.cf, #\+begin_src\s+example_output\s*, .*end_src)%] - **See also:** [`readstringlist()`][readstringlist], [`readreallist()`][readreallist] diff --git a/content/reference/functions/readreallist.markdown b/content/reference/functions/readreallist.markdown index 42ab08a67..694b149ea 100644 --- a/content/reference/functions/readreallist.markdown +++ b/content/reference/functions/readreallist.markdown @@ -37,5 +37,4 @@ Output: [%CFEngine_include_snippet(readreallist.cf, #\+begin_src\s+example_output\s*, .*end_src)%] - **See also:** [`readstringlist()`][readstringlist], [`readintlist()`][readintlist] diff --git a/content/reference/functions/readstringlist.markdown b/content/reference/functions/readstringlist.markdown index e5a4f01cd..4380da8b1 100644 --- a/content/reference/functions/readstringlist.markdown +++ b/content/reference/functions/readstringlist.markdown @@ -37,5 +37,4 @@ Output: [%CFEngine_include_snippet(readstringlist.cf, #\+begin_src\s+example_output\s*, .*end_src)%] - **See also:** [`readintlist()`][readintlist], [`readreallist()`][readreallist] diff --git a/content/reference/functions/regcmp.markdown b/content/reference/functions/regcmp.markdown index ca4822ee2..0cacae98f 100644 --- a/content/reference/functions/regcmp.markdown +++ b/content/reference/functions/regcmp.markdown @@ -24,5 +24,4 @@ as a regular character (they only match end of string). You can do this using either standard regular expression syntax or using the additional features of PCRE (where `(?ms)` changes the way that ., `^` and `$` behave), e.g. - **See also:** `regline()`, `strcmp()` diff --git a/content/reference/functions/reverse.markdown b/content/reference/functions/reverse.markdown index 9d9419f0b..1c789c926 100644 --- a/content/reference/functions/reverse.markdown +++ b/content/reference/functions/reverse.markdown @@ -18,7 +18,6 @@ This is a simple function to reverse a list. **Example:** - [%CFEngine_include_snippet(reverse.cf, #\+begin_src cfengine3, .*end_src)%] Output: diff --git a/content/reference/functions/string_mustache.markdown b/content/reference/functions/string_mustache.markdown index 3a96bf5f8..9d23176f9 100644 --- a/content/reference/functions/string_mustache.markdown +++ b/content/reference/functions/string_mustache.markdown @@ -15,7 +15,6 @@ The usual Mustache facilities like conditional evaluation and loops are availabl [%CFEngine_include_snippet(string_mustache.cf, #\+begin_src cfengine3, .*end_src)%] - Output: [%CFEngine_include_snippet(string_mustache.cf, #\+begin_src\s+example_output\s*, .*end_src)%] diff --git a/content/reference/language-concepts/augments.markdown b/content/reference/language-concepts/augments.markdown index a443519db..558a183b8 100644 --- a/content/reference/language-concepts/augments.markdown +++ b/content/reference/language-concepts/augments.markdown @@ -19,10 +19,7 @@ bundle sequence, without editing `promises.cf`, by adding the Augments file belo ```json { "inputs": ["services/my_policy_file.cf"], - "vars": - { - "control_common_bundlesequence_end": ["my_bundle_name"] - } + "vars": { "control_common_bundlesequence_end": ["my_bundle_name"] } } ``` @@ -108,21 +105,16 @@ Filenames entered here will appear in the `def.augments_inputs` variable. ```json { - "inputs": [ "services/hello-world.cf", "example.cf", "/tmp/my_policy.cf" ], - "vars": { - "augments_inputs": [ "goodbye.cf" ] - } + "inputs": ["services/hello-world.cf", "example.cf", "/tmp/my_policy.cf"], + "vars": { "augments_inputs": ["goodbye.cf"] } } ``` The above Augments results in `$(sys.policy_entry_dirname)/services/hello-world.cf`, `$(sys.policy_entry_dirname)/example.cf` and `/tmp/my_policy.cf` being added to inputs. - ```json { - "vars": { - "augments_inputs": [ "goodbye.cf" ] - } + "vars": { "augments_inputs": ["goodbye.cf"] } } ``` @@ -130,7 +122,6 @@ The above Augments results in `$(sys.policy_entry_dirname)/goodbye.cf` being add ### variables - This key is supported in both `host_specific.json`, `def.json`, `def_preferred.json`, and augments loaded by the [_augments_ key][Augments#augments]. Variables defined here can target a _namespace_ and or _bundle_ scope explicitly. When defined from `host_specific.json`, variables default to the ```variables``` _bundle_ in the ```data``` _namespace_ (`$(data:variables.MyVariable)`). @@ -139,11 +130,7 @@ For example: ```json { - "variables": { - "VariableWithImplicitNamespaceAndBundle": { - "value": "value" - } - } + "variables": { "VariableWithImplicitNamespaceAndBundle": {"value": "value"} } } ``` @@ -153,11 +140,7 @@ For example: ```json { - "variables": { - "my_bundle.VariableWithImplicitNamespace": { - "value": "value" - } - } + "variables": { "my_bundle.VariableWithImplicitNamespace": {"value": "value"} } } ``` @@ -167,11 +150,7 @@ For example: ```json { - "variables": { - "MyNamespace:my_bundle.Variable": { - "value": "value" - } - } + "variables": { "MyNamespace:my_bundle.Variable": {"value": "value"} } } ``` @@ -181,12 +160,12 @@ For example, this JSON: ```json { - "variables": { - "MyNamespace:my_bundle.Variable": { - "value": "value", - "comment": "An optional note about why this variable is important" - } + "variables": { + "MyNamespace:my_bundle.Variable": { + "value": "value", + "comment": "An optional note about why this variable is important" } + } } ``` @@ -212,12 +191,12 @@ For example, this JSON: ```json { - "variables": { - "MyNamespace:my_bundle.Variable": { - "value": "value", - "tags": [ "inventory", "attribute_name=My Inventory" ] - } + "variables": { + "MyNamespace:my_bundle.Variable": { + "value": "value", + "tags": ["inventory", "attribute_name=My Inventory"] } + } } ``` @@ -258,12 +237,12 @@ Thus: ```json { - "vars": { - "phone": "22-333-4444", - "myplatform": "$(sys.os)", - "MyBundle.MyVariable": "MyValue in MyBundle.MyVariable", - "MyNamespace:MyBundle.MyVariable": "MyValue in MyNamespace:MyBundle.MyVariable" - } + "vars": { + "phone": "22-333-4444", + "myplatform": "$(sys.os)", + "MyBundle.MyVariable": "MyValue in MyBundle.MyVariable", + "MyNamespace:MyBundle.MyVariable": "MyValue in MyNamespace:MyBundle.MyVariable" + } } ``` @@ -327,19 +306,23 @@ classes as an [anchored regular expression][anchored] unless the string ends wit ```json { - "classes": { - "augments_class_from_regex_my_always": [ "any" ], - "augments_class_from_regex_my_other_apache": [ "server[34]", "debian.*" ], - "augments_class_from_regex_my_other_always": [ "augments_class_from_regex_my_always" ], - "augments_class_from_regex_when_MISSING_not_defined": [ "^(?!MISSING).*" ], - "augments_class_from_regex": [ "cfengine_\\d+" ], - "augments_class_from_single_class_as_regex": [ "cfengine" ], - "augments_class_from_single_class_as_expression": [ "cfengine::" ], - "augments_class_from_classexpression_and": [ "cfengine.cfengine_3::" ], - "augments_class_from_classexpression_not": [ "!MISSING::" ], - "augments_class_from_classexpression_or": [ "cfengine|cfengine_3::" ], - "augments_class_from_classexpression_complex": [ "(cfengine|cfengine_3).!MISSING::" ] - } + "classes": { + "augments_class_from_regex_my_always": ["any"], + "augments_class_from_regex_my_other_apache": ["server[34]", "debian.*"], + "augments_class_from_regex_my_other_always": [ + "augments_class_from_regex_my_always" + ], + "augments_class_from_regex_when_MISSING_not_defined": ["^(?!MISSING).*"], + "augments_class_from_regex": ["cfengine_\\d+"], + "augments_class_from_single_class_as_regex": ["cfengine"], + "augments_class_from_single_class_as_expression": ["cfengine::"], + "augments_class_from_classexpression_and": ["cfengine.cfengine_3::"], + "augments_class_from_classexpression_not": ["!MISSING::"], + "augments_class_from_classexpression_or": ["cfengine|cfengine_3::"], + "augments_class_from_classexpression_complex": [ + "(cfengine|cfengine_3).!MISSING::" + ] + } } ``` @@ -350,17 +333,17 @@ are supported when using the _dict_ structure. ```json { - "classes": { - "myclass_defined_by_augments_in_def_json_3_18_0_v0": { - "class_expressions": [ "linux.redhat::", "cfengine|linux::" ], - "comment": "Optional description about why this class is important", - "tags": [ "optional", "tags" ] - }, - "myclass_defined_by_augments_in_def_json_3_18_0_v1": { - "regular_expressions": [ "linux.*", "cfengine.*" ], - "tags": [ "optional", "tags" ] - } + "classes": { + "myclass_defined_by_augments_in_def_json_3_18_0_v0": { + "class_expressions": ["linux.redhat::", "cfengine|linux::"], + "comment": "Optional description about why this class is important", + "tags": ["optional", "tags"] + }, + "myclass_defined_by_augments_in_def_json_3_18_0_v1": { + "regular_expressions": ["linux.*", "cfengine.*"], + "tags": ["optional", "tags"] } + } } ``` @@ -372,28 +355,32 @@ for use. Thus: ```json { - "classes": { - "augments_class_from_regex_my_always": [ "any" ], - "augments_class_from_regex_my_other_apache": [ "server[34]", "debian.*" ], - "augments_class_from_regex_my_other_always": [ "augments_class_from_regex_my_always" ], - "augments_class_from_regex_when_MISSING_not_defined": [ "^(?!MISSING).*" ], - "augments_class_from_regex": [ "cfengine_\\d+" ], - "augments_class_from_single_class_as_regex": [ "cfengine" ], - "augments_class_from_single_class_as_expression": [ "cfengine::" ], - "augments_class_from_classexpression_and": [ "cfengine.cfengine_3::" ], - "augments_class_from_classexpression_not": [ "!MISSING::" ], - "augments_class_from_classexpression_or": [ "cfengine|cfengine_3::" ], - "augments_class_from_classexpression_complex": [ "(cfengine|cfengine_3).!MISSING::" ], - "myclass_defined_by_augments_in_def_json_3_18_0_v0": { - "class_expressions": [ "linux.redhat::", "cfengine|linux::" ], - "comment": "Optional description about why this class is important", - "tags": [ "optional", "tags" ] - }, - "myclass_defined_by_augments_in_def_json_3_18_0_v1": { - "regular_expressions": [ "linux.*", "cfengine.*" ], - "tags": [ "optional", "tags" ] - } + "classes": { + "augments_class_from_regex_my_always": ["any"], + "augments_class_from_regex_my_other_apache": ["server[34]", "debian.*"], + "augments_class_from_regex_my_other_always": [ + "augments_class_from_regex_my_always" + ], + "augments_class_from_regex_when_MISSING_not_defined": ["^(?!MISSING).*"], + "augments_class_from_regex": ["cfengine_\\d+"], + "augments_class_from_single_class_as_regex": ["cfengine"], + "augments_class_from_single_class_as_expression": ["cfengine::"], + "augments_class_from_classexpression_and": ["cfengine.cfengine_3::"], + "augments_class_from_classexpression_not": ["!MISSING::"], + "augments_class_from_classexpression_or": ["cfengine|cfengine_3::"], + "augments_class_from_classexpression_complex": [ + "(cfengine|cfengine_3).!MISSING::" + ], + "myclass_defined_by_augments_in_def_json_3_18_0_v0": { + "class_expressions": ["linux.redhat::", "cfengine|linux::"], + "comment": "Optional description about why this class is important", + "tags": ["optional", "tags"] + }, + "myclass_defined_by_augments_in_def_json_3_18_0_v1": { + "regular_expressions": ["linux.*", "cfengine.*"], + "tags": ["optional", "tags"] } + } } ``` @@ -465,7 +452,6 @@ myclass_defined_by_augments_in_def_json_3_18_0_v1 optional,tags,sourc * Support for dict structure for classes and support for metadata (`comment`, `tags`) added. * Classes are defined as _soft_ classes instead of _hard_ classes. - ### augments This key is supported in `def.json`, `def_preferred.json`, and augments loaded by the [_augments_ key][Augments#augments]. @@ -482,13 +468,11 @@ The `def.json` next to the policy entry: ```json { - "vars":{ + "vars": { "my_var": "defined in def.json", "my_other_var": "Defined ONLY in def.json" }, - "augments": [ - "/var/cfengine/augments/$(sys.flavor).json" - ] + "augments": ["/var/cfengine/augments/$(sys.flavor).json"] } ``` diff --git a/content/reference/language-concepts/classes.markdown b/content/reference/language-concepts/classes.markdown index e4af681e5..57f0999af 100644 --- a/content/reference/language-concepts/classes.markdown +++ b/content/reference/language-concepts/classes.markdown @@ -248,7 +248,6 @@ bundle is evaluated (for classes with a `bundle` scope) or until the agent exits (for classes with a `namespace` scope). See `cancel_kept`, `cancel_repaired`, and `cancel_notkept` in classes body. - This example defines a few soft classes local to the `myclasses` bundle. ```cf3 @@ -284,8 +283,6 @@ reports: functions - `/etc/shadow` and `/etc/passwd`. If both of these files are present the `oth_class` class will also be set. - - ### Negative knowledge If a class is set, then it is certain that the corresponding fact is true. @@ -447,7 +444,6 @@ R: Hello from berlin R: Hello from berlin, if edition ``` - In this example, lists of cities are defined in the `vars` section and these lists are combined into a list of all cities. These variable lists are used to qualify the greetings and to make the policy more concise. In the [`classes`][classes] @@ -468,7 +464,6 @@ defined and that you must explicitly canonify when verifying classes. [%CFEngine_include_example(class-automatic-canonificiation.cf)%] - ## Operators and precedence Classes promises define new classes based on combinations of old ones. This is diff --git a/content/reference/language-concepts/modules/package-module-api.markdown b/content/reference/language-concepts/modules/package-module-api.markdown index c36dcbbed..22c65e7f1 100644 --- a/content/reference/language-concepts/modules/package-module-api.markdown +++ b/content/reference/language-concepts/modules/package-module-api.markdown @@ -408,7 +408,6 @@ commands. Alternatively, it may redirect their output to standard error instead, but this will not be formatted using CFEngine's normal log formatting and is not recommended. - ## Caching For performance reasons, CFEngine will cache the list of packages returned from diff --git a/content/reference/language-concepts/pattern-matching-and-referencing.markdown b/content/reference/language-concepts/pattern-matching-and-referencing.markdown index ed6805600..e83fc85a0 100644 --- a/content/reference/language-concepts/pattern-matching-and-referencing.markdown +++ b/content/reference/language-concepts/pattern-matching-and-referencing.markdown @@ -16,7 +16,6 @@ parenthetic expressions. For instance, suppose we have the string: and apply the regular expression - "Mary ([^l]+)little (.*)" The pattern matches the entire string, and it contains two parenthesized @@ -43,7 +42,6 @@ files: # on "Runaway change warning" - "/home/mark/tmp/cf([23])?_(.*)" edit_line => myedit("second backref: $(match.2)"); } @@ -136,7 +134,6 @@ Try this example on the file seven eleven - The resulting file is edited like this: [First section] @@ -187,7 +184,6 @@ CFEngine. # ###################################################################### - body common control { version => "1.2.3"; @@ -206,7 +202,6 @@ files: ######################################################## - bundle edit_line comment_lines_matching { vars: @@ -223,7 +218,6 @@ bundle edit_line comment_lines_matching # Bodies ######################################## - body replace_with comment(c) { replace_value => "$(c) $(match.1)"; @@ -260,19 +254,16 @@ body common control ######################################## - bundle agent wintest { files: "c:/tmp/file/f.*" # "best guess" interpretation delete => nodir; - "c:\tmp\file" delete => nodir, pathtype => "literal"; # force literal string interpretation - "C:/windows/tmp/f\d" delete => nodir, pathtype => "regex"; # force regular expression interpretation @@ -280,7 +271,6 @@ files: ######################################## - body delete nodir { rmdirs => "false"; @@ -361,7 +351,6 @@ CFEngine expects an unanchored regex: `(^|:)bob(:|$)`. But if CFEngine expects an anchored regular expression, then it starts getting ugly, and you'd need to use `bob:.*|.*:bob:.*|.*:bob`. - ### Special topics on Regular Expressions Regular expressions are a complicated subject, and really are beyond the scope diff --git a/content/reference/language-concepts/policy-evaluation.markdown b/content/reference/language-concepts/policy-evaluation.markdown index aa58151d6..179c1226f 100644 --- a/content/reference/language-concepts/policy-evaluation.markdown +++ b/content/reference/language-concepts/policy-evaluation.markdown @@ -42,7 +42,6 @@ CFEngine policy evaluation is done in several steps: 1. Pre-evaluation step is taking place. 1. Exact policy evaluation is done. - For more information regarding each step please see the detailed description below. diff --git a/content/reference/promise-types/_index.markdown b/content/reference/promise-types/_index.markdown index 66c12e904..74361a84e 100644 --- a/content/reference/promise-types/_index.markdown +++ b/content/reference/promise-types/_index.markdown @@ -436,7 +436,6 @@ promises of the form: ID:promise-type:promiser. ``` - ### classes **Type:** `body classes` @@ -503,7 +502,6 @@ the file existence, but `promise_repaired` for the permissions. If you need separate reports, you should code two separate promises rather than 'overloading' a single one. - #### repair_failed **Description:** Classes to be defined globally if the promise could not be @@ -846,7 +844,6 @@ bundle agent cmdtest "/tmp/test" copy_from => copy("/etc/passwd"); - "/tmp/test" classes => example, transformer => "/bin/grep -q lkajfo999999 $(this.promiser)"; @@ -1154,7 +1151,6 @@ If mention is made of "tags" on a *bundle*, what is actually meant is meta *prom **History:** Was introduced in 3.3.0, Nova 2.2.0 (2012) - ### unless **Description:** Class expression to further restrict the promise context. This diff --git a/content/reference/promise-types/access.markdown b/content/reference/promise-types/access.markdown index 0b54ad66e..d725c435c 100644 --- a/content/reference/promise-types/access.markdown +++ b/content/reference/promise-types/access.markdown @@ -64,7 +64,6 @@ reporting and orchestration. resource_type => "context", admit_ips => { "127.0.0.1" }; - "value of my test_scalar, can expand variables here - $(sys.host)" comment => "Grant access to the string in quotes, by name test_scalar", handle => "test_scalar", @@ -96,7 +95,6 @@ reporting and orchestration. resource_type => "query", admit_ips => { "10.1.2.0/24" }; - } ``` @@ -104,7 +102,6 @@ Using the built-in `report_data_select` body `default_data_select_host`: [%CFEngine_include_snippet(controls/reports.cf, .+default_data_select_host, \})%] - The access promise allows overlapping promises to be made, and these are kept on a first-come-first-served basis. Thus file objects (promisers) should be listed in order of most-specific file first. In this way, specific @@ -114,7 +111,6 @@ promises will override less specific ones. ## Attributes - ### admit_hostnames **Description:** A list of hostnames or domains that should have access to the object. @@ -332,7 +328,6 @@ bundle server my_access_rules() } ``` - **Notes:** Only regular expressions or exact matches are allowed in this list, as non-specific matches are too greedy for denial. @@ -613,7 +608,6 @@ If the resource type is `bundle` then the specific bundles are allowed to be remotely executed with `cf-runagent --remote-bundles` from the specified hosts. The promiser is an anchored regular expression. - **Example:** ```cf3 diff --git a/content/reference/promise-types/classes.markdown b/content/reference/promise-types/classes.markdown index 7f3627984..5f059fc61 100644 --- a/content/reference/promise-types/classes.markdown +++ b/content/reference/promise-types/classes.markdown @@ -24,10 +24,8 @@ classes: - The promiser is automatically canonified when classes are defined. - Classes are not automatically canonified when checked. - [%CFEngine_include_example(class-automatic-canonificiation.cf)%] - - The term ```class``` and ```context``` are sometimes used interchangeably. - The following attributes to make a complete promise. @@ -271,7 +269,6 @@ persistent_classes:: inputs => { "classes.cf" }; } - bundle agent test { reports: @@ -315,7 +312,6 @@ classes: The class on the left-hand side will be set if the class expression on the right-hand side evaluates to false. - **Type:** `class` **Allowed input range:** `[a-zA-Z0-9_!@@$|.()\[\]{}:]+` diff --git a/content/reference/promise-types/commands.markdown b/content/reference/promise-types/commands.markdown index e41e875ad..8ce78f216 100644 --- a/content/reference/promise-types/commands.markdown +++ b/content/reference/promise-types/commands.markdown @@ -525,7 +525,6 @@ reports: "Module set variable $(module_name.myscalar)"; } - bundle agent modtest { vars: diff --git a/content/reference/promise-types/custom.markdown b/content/reference/promise-types/custom.markdown index 05818e64a..fe45c2315 100644 --- a/content/reference/promise-types/custom.markdown +++ b/content/reference/promise-types/custom.markdown @@ -119,7 +119,6 @@ import sys import os from cfengine import PromiseModule, ValidationError - class GitPromiseTypeModule(PromiseModule): def validate_promise(self, promiser, attributes, metadata): if not promiser.startswith("/"): @@ -151,7 +150,6 @@ class GitPromiseTypeModule(PromiseModule): self.log_error(f"Failed to clone '{url}' -> '{folder}'") self.promise_not_kept() - if __name__ == "__main__": GitPromiseTypeModule().start() ``` @@ -405,18 +403,14 @@ You can also include log messages in the JSON data: { "operation": "evaluate_promise", "promiser": "/opt/cfengine/masterfiles", - "attributes": { - "repo": "https://github.com/cfengine/masterfiles" - }, + "attributes": { "repo": "https://github.com/cfengine/masterfiles" }, "log": [ { "level": "info", "message": "Cloning 'https://github.com/cfengine/masterfiles' -> '/opt/cfengine/masterfiles'..." } ], - "result_classes": [ - "masterfiles_cloned" - ], + "result_classes": ["masterfiles_cloned"], "result": "repaired" } ``` @@ -448,10 +442,7 @@ The attributes from the above example would be sent like this: ```json { "policy": "present", - "members": { - "include": ["alice", "bob"], - "exclude": ["malcom"] - } + "members": { "include": ["alice", "bob"], "exclude": ["malcom"] } } ``` diff --git a/content/reference/promise-types/databases.markdown b/content/reference/promise-types/databases.markdown index 55c6edad2..70f7fb08d 100644 --- a/content/reference/promise-types/databases.markdown +++ b/content/reference/promise-types/databases.markdown @@ -77,8 +77,6 @@ body database_server name } ``` - - ```cf3 body common control { @@ -110,8 +108,6 @@ databases: database_server => myserver; - - } ################################################ diff --git a/content/reference/promise-types/files/_index.markdown b/content/reference/promise-types/files/_index.markdown index 14aa66e1b..f7290245e 100644 --- a/content/reference/promise-types/files/_index.markdown +++ b/content/reference/promise-types/files/_index.markdown @@ -380,7 +380,6 @@ aces = { * The group id is not a valid alternative. * This ACL is **required** when `acl_method` is set to `overwrite`. - * `gid` A valid group identifier for the system and cannot be empty. However, in @@ -441,7 +440,6 @@ aces = { | c | Change Permissions | | o | Take Ownership | - * `perm_type` (optional) Can be set to either `allow` or `deny`, and defaults to `allow`. `deny` is @@ -679,7 +677,6 @@ hash => "md5"; } ``` - #### report_changes **Description:** Specify criteria for change warnings using the `report_changes` menu option. @@ -748,7 +745,6 @@ Diffs will not be reported for files that are larger than 80MB in size. Diffs will not be reported if the number of lines between the first and last change exceed 4500. Diffs for binary files are not generated. Files are considered binary files if [control character](http://en.wikipedia.org/wiki/Control_character#In_ASCII) 0-32 excluding 9, 10, 13, and 32, or 127 are found in the file. - **Type:** [`boolean`][boolean] **Example:** @@ -889,7 +885,6 @@ used. * `digest` a synonym for `hash` - **Default value:** mtime or ctime differs **Example:** @@ -1403,10 +1398,8 @@ verify => "true"; **Example:** - [%CFEngine_include_example(files_content.cf)%] - **History:** Was introduced in 3.16.0 **Note:** You cannot `content` in combination with the other edit operations @@ -1475,7 +1468,6 @@ The value `keep` instructs CFEngine not to remove directory links. The values `delete` and `tidy` are synonymous, and instruct CFEngine to remove directory links. - **Type:** (menu option) **Allowed input range:** @@ -1506,7 +1498,6 @@ are **not** deleted. **Description:** true/false whether to delete empty directories during recursive deletion - **Type:** [`boolean`][boolean] **Example:** @@ -1592,7 +1583,6 @@ should be considered part of the promise or simply a boundary that marks the edge of the search. If true, the promiser directory will also promise the same attributes as the files inside it. `rmdirs` in `delete` bodies /ignore/ this attribute. A separate files promise must be made in order to delete the top level directory. - **Type:** [`boolean`][boolean] **Example:** @@ -1846,7 +1836,6 @@ empty_file_before_editing => "true"; } ``` - #### inherit **Description:** If true this causes the sub-bundle to inherit the private @@ -1919,7 +1908,6 @@ Back slash lines will only be concatenated if the file requires editing, and will not be restored. Restoration of the backslashes is not possible in a meaningful and convergent fashion. - **Type:** [`boolean`][boolean] **Default value:** false @@ -1964,7 +1952,6 @@ files, plus the one "main" file. In the example above, the file foo.3 will be renamed foo.4, but the old version of the file foo.4 will be deleted (that is, it "falls off the end" of the rotation). - **Type:** `int` **Allowed input range:** `0,99` @@ -2036,7 +2023,6 @@ bundle agent example [%CFEngine_include_example(template_method-inline_mustache.cf)%] - **History:** Was introduced in 3.12.0 **See also:** [template_method][files#template_method], `template_data`, `readjson()`, `parsejson()`, @@ -2293,7 +2279,6 @@ body file_select used_recently file_result => "atime"; } - body file_select not_used_much { # files not accessed since 00:00 1st Jan 2000 (in the local timezime) @@ -2563,7 +2548,6 @@ source => "/tmp/source"; [%CFEngine_include_example(symlink.cf)%] - **Notes:** On Windows, hard links are the only supported type. @@ -2586,7 +2570,6 @@ source => "/path/to/source"; } ``` - #### when_linking_children **Description:** Policy for overriding existing files when linking @@ -3235,7 +3218,6 @@ for `inline_mustache` and `mustache`. For mustache explanation see [%CFEngine_include_example(template_method-inline_mustache.cf)%] - **History:** Was introduced in 3.12.0 **See also:** `edit_template_string`, `template_data`, `datastate()` @@ -3276,10 +3258,8 @@ HTML, use the triple mustache: ```{{{name}}}``` or an ampersand A variable "miss" returns an empty string. - [%CFEngine_include_example(mustache_variables.cf)%] - ##### template_method mustache Sections Sections render blocks of text one or more times, depending on the value of the @@ -3295,25 +3275,19 @@ The behavior of the section is determined by the value of the key. If the key exists and has a value of false or an empty list, the HTML between the pound and slash will not be displayed. - [%CFEngine_include_example(mustache_sections_empty_list.cf)%] - **Non-Empty Lists:** - [%CFEngine_include_example(mustache_sections_non_empty_list.cf)%] - **Non-False Values:** When the value is non-false but not a list, it will be used as the context for a single rendering of the block. - [%CFEngine_include_example(mustache_sections_non_false_value.cf)%] - ##### template_method mustache Inverted Sections An inverted section begins with a caret (hat) and ends with a slash. That is @@ -3325,27 +3299,21 @@ of the key, inverted sections may render text once based on the inverse value of the key. That is, they will be rendered if the key doesn't exist, is false, or is an empty list. - [%CFEngine_include_example(mustache_sections_inverted.cf)%] - ##### template_method mustache Comments Comments begin with a bang and are ignored. Comments may contain newlines. - [%CFEngine_include_example(mustache_comments.cf)%] - ##### template_method mustache Set Delimiter Set Delimiter tags start with an equal sign and change the tag delimiters from ```{{``` and ```}}``` to custom strings. - [%CFEngine_include_example(mustache_set_delimiters.cf)%] - ##### template_method mustache extensions The following are **CFEngine-specific extensions**. @@ -3354,32 +3322,23 @@ The following are **CFEngine-specific extensions**. over the top level of a container `{{#-top-}} ... {{/-top-}}` and rendering json representation of data given with `$` and `%`. - [%CFEngine_include_example(mustache_extension_top.cf)%] - `%` variable prefix causing data to be rendered as multi-line json representation. Like output from `storejson()`. - [%CFEngine_include_example(mustache_extension_multiline_json.cf)%] - `$` variable prefix causing data to be rendered as compact json representation. Like output from `format()` with the ```%S``` format string. - [%CFEngine_include_example(mustache_extension_compact_json.cf)%] - `@` expands the current key being iterated to complement the value as accessed with `.`. - [%CFEngine_include_example(mustache_extension_expand_key.cf)%] - - **See also:** `edit_template`, `template_data`, `datastate()` ### touch diff --git a/content/reference/promise-types/files/edit_line/_index.markdown b/content/reference/promise-types/files/edit_line/_index.markdown index 7e19f502f..b8e7b3f15 100644 --- a/content/reference/promise-types/files/edit_line/_index.markdown +++ b/content/reference/promise-types/files/edit_line/_index.markdown @@ -157,7 +157,6 @@ body changes lay_a_tripwire } ``` - ## Common edit_line attributes These attributes can be used by any promise type that applies to `edit_line` @@ -295,7 +294,6 @@ desired result. **** - #### include\_end\_delimiter **Description:** Whether to include the section delimiter @@ -430,7 +428,6 @@ file as the end region if it is unable to match the end pattern. If the `select_end` attribute is omitted, the selected region will run to the end of the file no matter what the value of `select_end_match_eof` is set to. - **Type:** [`boolean`][boolean] **Default value:** false diff --git a/content/reference/promise-types/files/edit_line/field_edits.markdown b/content/reference/promise-types/files/edit_line/field_edits.markdown index b50f13074..8ccf4f20e 100644 --- a/content/reference/promise-types/files/edit_line/field_edits.markdown +++ b/content/reference/promise-types/files/edit_line/field_edits.markdown @@ -301,7 +301,6 @@ value_separator => ","; } ``` - ### select_region **Description:** Constrains `edit_line` operations to region identified by matching regular expressions. diff --git a/content/reference/promise-types/files/edit_line/insert_lines.markdown b/content/reference/promise-types/files/edit_line/insert_lines.markdown index a602e80de..af0810dc9 100644 --- a/content/reference/promise-types/files/edit_line/insert_lines.markdown +++ b/content/reference/promise-types/files/edit_line/insert_lines.markdown @@ -424,7 +424,6 @@ first_last => "last"; The expression must match a whole line, not a fragment within a line; that is, it is [anchored][anchored]. - **Type:** `string` **Allowed input range:** `.*` diff --git a/content/reference/promise-types/files/edit_xml/_index.markdown b/content/reference/promise-types/files/edit_xml/_index.markdown index 8eaec5ff6..2c1700482 100644 --- a/content/reference/promise-types/files/edit_xml/_index.markdown +++ b/content/reference/promise-types/files/edit_xml/_index.markdown @@ -25,7 +25,6 @@ new or manipulate existing XML documents. CFEngine_promise_attribute macro functions. If the name changes, then promise prototypes will not work. --> - The following attributes are available in all `edit_xml` promise types. ### build_xpath diff --git a/content/reference/promise-types/guest_environments.markdown b/content/reference/promise-types/guest_environments.markdown index d7370b402..deafb8a9a 100644 --- a/content/reference/promise-types/guest_environments.markdown +++ b/content/reference/promise-types/guest_environments.markdown @@ -26,8 +26,6 @@ to manage what goes on within the virtual guests. For that purpose you should run CFEngine directly on the virtual machine, as if it were any other machine. - - ```cf3 site1:: @@ -82,7 +80,6 @@ guest_environments: environment_host => "ubuntu"; ``` - This attribute is required. **History:** this feature was introduced in Nova 2.0.0 (2010), Community diff --git a/content/reference/promise-types/measurements.markdown b/content/reference/promise-types/measurements.markdown index 986228b45..fce3f4823 100644 --- a/content/reference/promise-types/measurements.markdown +++ b/content/reference/promise-types/measurements.markdown @@ -32,7 +32,6 @@ bundle monitor self_watch # match_value: #root \s+ [0-9.]+ \s+ [0-9.]+ \s+ [0-9.]+ \s+ [0-9.]+ \s+ [0-9.]+ \s+ [0-9]+ \s+ [0-9]+ \s+ ([0-9]+) .*" - "/var/cfengine/state/cf_rootprocs" handle => "cf_monitord_RSS", @@ -53,7 +52,6 @@ body match_value proc_value(x,y) } ``` - ```cf3 bundle monitor watch_diskspace { @@ -417,7 +415,6 @@ expireafter => "10"; } ``` - #### select_multiline_policy **Description:** Regular expression for matching line location diff --git a/content/reference/promise-types/methods.markdown b/content/reference/promise-types/methods.markdown index 40506762a..dfe58c59d 100644 --- a/content/reference/promise-types/methods.markdown +++ b/content/reference/promise-types/methods.markdown @@ -140,7 +140,6 @@ methods: inherit => "true"; } - body edit_defaults example { inherit => "true"; diff --git a/content/reference/promise-types/packages-deprecated.markdown b/content/reference/promise-types/packages-deprecated.markdown index ca6fa1260..7d696f57f 100644 --- a/content/reference/promise-types/packages-deprecated.markdown +++ b/content/reference/promise-types/packages-deprecated.markdown @@ -152,7 +152,6 @@ Normal ordering for packages is the following: | upgrade | unable | unable | | patch | unable | unable | - ```cf3 bundle agent packages { @@ -1075,7 +1074,6 @@ package_version_equal_command => "dpkg --compare-versions ${v1} eq ${v2}"; **History:** Was introduced in 3.4.0 (2012) - ### package_policy **Description:** Criteria for package installation/upgrade on the current @@ -1121,7 +1119,6 @@ Verify the correctness of the package (manager dependent). The promise is kept if the package is installed correctly, not kept otherwise. Requires setting `package_verify_command`. - **Default value:** verify **Example:** @@ -1157,7 +1154,6 @@ requirement. For example, if `package_select` is `<` and series, like: `2.2.1`, `2.2.2`, `2.3.0`, because they all satisfy the version requirement. - **Type:** (menu option) **Allowed input range:** diff --git a/content/reference/promise-types/packages.markdown b/content/reference/promise-types/packages.markdown index 7c6656b55..eb085b288 100644 --- a/content/reference/promise-types/packages.markdown +++ b/content/reference/promise-types/packages.markdown @@ -115,7 +115,6 @@ packages: architecture => "x86_64"; ``` - ### options **Description:** Options to pass to the underlying package module. @@ -145,7 +144,6 @@ packages: options => { "-o", "APT::Install-Recommends=0" }; ``` - ### policy **Description:** Whether the package should be present or absent on the system. @@ -165,7 +163,6 @@ packages: package_module => apt_get; ``` - ### version **Description:** The version we want the promise to consider. @@ -192,7 +189,6 @@ packages: version => "latest"; ``` - ### package_module **Type:** `body package_module` @@ -224,7 +220,6 @@ body package_module apt_get } ``` - #### query_installed_ifelapsed **Description:** How often to query the system for currently installed packages. @@ -506,7 +501,6 @@ packages: options => { "lpp_source=lppaix710304" }; ``` - **Notes:** * [```options```][packages#options] attribute support to specify diff --git a/content/reference/promise-types/processes.markdown b/content/reference/promise-types/processes.markdown index 119edc1ca..5931bc89b 100644 --- a/content/reference/promise-types/processes.markdown +++ b/content/reference/promise-types/processes.markdown @@ -81,7 +81,6 @@ commands: * CFEngine will not allow you to signal processes 1-4 or the agent process itself for fear of bringing down the system. - * Process promises depend on the `ps` native tool, which by default truncates lines at 128 columns on HP-UX. It is recommended to edit the file `/etc/default/ps` and increase the `DEFAULT_CMD_LINE_WIDTH` setting to 1024 to @@ -495,7 +494,6 @@ processes: process_stop => "/etc/init.d/snmp stop"; ``` - ### restart_class **Description:** A class to be defined globally if the process is not diff --git a/content/reference/promise-types/services.markdown b/content/reference/promise-types/services.markdown index 7ede7f4ac..da7135961 100644 --- a/content/reference/promise-types/services.markdown +++ b/content/reference/promise-types/services.markdown @@ -163,7 +163,6 @@ standard library. * When `service_type` is `generic` any string is allowed and `service_bundle` is responsible for interpreting and implementing the desired state based on the `service_policy` value. Historically `service_type` `generic` has supported `start`, `stop`, `enable`, `disable`, `restart` and `reload`. - **Example:** ```cf3 @@ -187,7 +186,6 @@ bundle agent example service_policy => "my_custom_state", service_method => "my_custom_service_method"; - windows:: "AdobeARMservice" @@ -218,7 +216,6 @@ bundle agent example comment => "Ensure that the Auto Time Zone Updated is running, and set Startup Type to Manual."; - } body service_method my_custom_service_method @@ -357,7 +354,6 @@ body service_method example **Notes:** `on_demand` is not supported by Windows, and is implemented through inetd or xinetd on Unix. - #### service_bundle **Description:** The agent bundle to use when managing the service. diff --git a/content/reference/promise-types/storage.markdown b/content/reference/promise-types/storage.markdown index 2d27d9591..fe5ef5e04 100644 --- a/content/reference/promise-types/storage.markdown +++ b/content/reference/promise-types/storage.markdown @@ -14,7 +14,6 @@ storage: ...; ``` - ```cf3 bundle agent storage { diff --git a/content/reference/promise-types/vars.markdown b/content/reference/promise-types/vars.markdown index 417c8a929..bb2742644 100644 --- a/content/reference/promise-types/vars.markdown +++ b/content/reference/promise-types/vars.markdown @@ -24,7 +24,6 @@ enclose an arbitrary key are being deprecated in favor of the `data` variable ty **Example:** - ```cf3 vars: @@ -533,9 +532,7 @@ This augments file that defines `my_var` will be used for all examples shown her ```json { - "vars": { - "my_var": "My value defined from augments" - } + "vars": { "my_var": "My value defined from augments" } } ``` diff --git a/content/reference/special-variables/connection.markdown b/content/reference/special-variables/connection.markdown index 9b80540af..39ae95c16 100644 --- a/content/reference/special-variables/connection.markdown +++ b/content/reference/special-variables/connection.markdown @@ -30,7 +30,6 @@ access: admit_keys => { "$(connection.key)" }; ``` - ### connection.ip This variable contains the IP address of the connecting remote agent. @@ -42,7 +41,6 @@ access: admit_keys => { "$(connection.key)" }; ``` - ### connection.hostname This variable contains the hostname of the connecting client as determined by a diff --git a/content/reference/special-variables/const.markdown b/content/reference/special-variables/const.markdown index ca764153a..cec942beb 100644 --- a/content/reference/special-variables/const.markdown +++ b/content/reference/special-variables/const.markdown @@ -22,7 +22,6 @@ reports: ### const.dollar - ```cf3 reports: @@ -35,7 +34,6 @@ reports: ### const.dirsep - ```cf3 reports: diff --git a/content/reference/special-variables/sys.markdown b/content/reference/special-variables/sys.markdown index 45129ab68..6b4c77c01 100644 --- a/content/reference/special-variables/sys.markdown +++ b/content/reference/special-variables/sys.markdown @@ -839,7 +839,6 @@ variables report to the CFEngine Enterprise Database. [%CFEngine_include_snippet(sys_interfaces_ip_addresses_ipv4.cf, #\+begin_src\s+static_example_output\s*, .*end_src)%] - **History:** Was introduced in 3.3.0, Enterprise 2.2.0 (2011) ### sys.interfaces_data @@ -932,7 +931,6 @@ Outputs: R: eth0 flags: up broadcast running multicast - The following device flags are supported: * up @@ -1044,7 +1042,6 @@ are marked as "up" and have an IP address will be listed. ### sys.ipv4_1[interface_name] - The first octet of the IPv4 address of the system interface named as the associative array index, e.g. `$(ipv4_1[le0])` or `$(ipv4_1[xr1])`. @@ -1251,7 +1248,6 @@ R: 22 * 3.18.0 introduced - ### sys.ostype Another name for the operating system. @@ -1272,7 +1268,6 @@ The name of the directory where CFEngine saves the daemon pid files. **History:** Introduced in CFEngine 3.6 - ### sys.policy_entry_basename The basename of the first policy file read by the agent. For example @@ -1291,7 +1286,6 @@ The full path to the directory containing the first policy file read by the agen **See also:** [`sys.policy_entry_basename`][sys#sys.policy_entry_basename] [`sys.policy_entry_filename`][sys.policy_entry_filename] - **History:** - Introduced 3.12.0 @@ -1303,7 +1297,6 @@ The full path to the first policy file read by the agent. For example **See also:** [`sys.policy_entry_basename`][sys#sys.policy_entry_basename] [`sys.policy_entry_dirname`][sys#sys.policy_entry_dirname] - **History:** - Introduced 3.12.0 diff --git a/content/release-notes/supported-platforms.markdown b/content/release-notes/supported-platforms.markdown index d63809450..b94fd1681 100644 --- a/content/release-notes/supported-platforms.markdown +++ b/content/release-notes/supported-platforms.markdown @@ -36,10 +36,8 @@ Any supported host can be a policy server in Community installations of CFEngine | Ubuntu | 22.04, 24.04 | arm64 | | Windows | 2012, 2016, 2019 | x86-64 | - [Known issues][] also includes platform-specific notes. - CFEngine Enterprise has [Virtual I/O Server (VIOS) Recognized status](http://www.ibm.com/partnerworld/gsd/solutiondetails.do?solution=48493) from IBM. This means that CFEngine Enterprise has been technically verified by IBM to be installed in and manage VIOS environments. diff --git a/content/resources/additional-topics/agility.markdown b/content/resources/additional-topics/agility.markdown index 9a5a18087..5f74eb2fe 100644 --- a/content/resources/additional-topics/agility.markdown +++ b/content/resources/additional-topics/agility.markdown @@ -35,14 +35,12 @@ associated with a lack of agility: a blow, a fall or a loss. ### What make agility possible? - To understand agility, we have to understand time and the capacity for change. Agility is a relative concept: it's about adapting quickly enough, in the right context, with the right measure and in the right way. Below, we'll try to gain an engineering perspective on agility to see what enables it and what throttles it. - To respond to a challenge there are four stages that need attention: * To comprehend the challenge. @@ -50,13 +48,11 @@ To respond to a challenge there are four stages that need attention: * To respond to the challenge. * To confirm or verify the response. - Each of these phases takes actual clock-time and requires a certain flexibility. Our goal is to keep these phases simple and therefore cheap for the long-term. Affording the time and flexibility needed is the key to being agile. Technology can help with this, if we adopt sound practices. - Intuitively, we understand agility to be related to our capacity to respond to a situation. Let's try to pin this idea down more precisely. @@ -163,16 +159,13 @@ operational state. Acting quickly is not enough: we also need to be accurate in responding to change[^4]. We need to be able to: - * Model the desired outcome accurately in terms of universal policy coordinates: **Why**, **When**, **Where**, **What**, **How**. * Maximize the chance that the promised outcome will be achieved. - Precision is maximized when: - * Changes are _precise_, i.e. they can be made at a highly granular level, without disturbing areas that are not relevant (few side-effects). @@ -189,7 +182,6 @@ Precision is maximized when: whether the problem lies in an incorrect assumption or a flaw in the implementation. - CFEngine is a fault tolerant system - it continues to work on what it can even when some parts of its model don't work out as expected[^6]. @@ -198,14 +190,12 @@ Next: Efficiency, Previous: Precision, Up: Understanding agility The next challenge is concerns a human limitation. One of the greatest challenges in any organization lies in comprehending the system. - Comprehensibility increases if something is predictable, or steady in its behaviour, but it decreases in proportion to the number of things we need to think about - which includes the many different contexts such as environments, or groups of machines with different purposes or profiles. Predictability (Reliability) Predictability Comprehensibility =~ ---------------------------- = ---------------- Contexts Diversity - Our ability to comprehend behaviour depends on how predictable it is, i.e. how well it meets our expectations. For technology, we expect behaviour to be as close as possible on our intentions. CFEngine's maintenance of promises ensures that this is done with best possible effort and a rapid cycle of checking. To keep the number of contexts to a minimum, CFEngine avoids mixing up what policy is being expressed with how the promises are kept. It uses a declarative language to separate the what from the how. This allows ordinary users to see what was intended without having to know the meaning of how, as was the case when scripting was used to configure systems. @@ -217,24 +207,20 @@ Finally, if we think about the efficiency of a configuration, which is another w If the technology has a high overhead, the cost of maintaining change is high and efficiency is low: - The efficiency of the technology decreases with the more resources it uses, e.g. like memory and CPU. Resources used to run the technology itself are pure overhead and take away from the real work of your system. Resources used Resource Efficiency =~ 1 - --------------- Total resources - It is a design goal of CFEngine to maintain minimal overhead in all situations. The second aspect of efficiency is how much planning or rule-making is needed to manage the relevant issues. - The efficiency of a model decreases when you put more effort into managing a certain number of things. If you can manage a large number of things with a few simple constraints, that is efficient. Number of objects affected Model Efficiency =~ ------------------------------- Number of rules and constraints - General patterns play a role too in simplifying, because the reduce the number of special rules and constraints down to fewer more generic rules. If we make good use of patterns, we can make few rules that cover many cases. If there are no discernible patterns, every special case is a costly exception. This affects not just the technology cost, but also the cognitive cost (i.e. the comprehensibility). Efficiency therefore plays a role in agility, because it affects the cost of change. Greater efficiency generally means greater speed, and more greater likelihood for precision. @@ -242,10 +228,8 @@ Efficiency therefore plays a role in agility, because it affects the cost of cha Next: Agility in your work, Previous: Understanding agility, Up: Top 2 Aspects of CFEngine that bring agility - We can now summarize some qualities of CFEngine that favour agility: - * Ability to express clear intentions about desired outcome (comprehension). * Availability of insight into system performance and state (comprehension). @@ -400,7 +384,6 @@ Precision: performance and regulation are key issues, and scaling up and down for demand is probably the fastest rate of change. - #### High performance computing High Performance clusters are typically found in the oil and gas industry, in @@ -507,13 +490,11 @@ Precision: ### Separating what from how (DevOps) - If you have to designs a programmatic solution to a challenge, it will cost you highly in terms of cognitive investment, testing and clarity of purpose to future users. Thinkingprocess(how) instead ofknowledge(what) is a classic carry-over from the era of 2nd Wave industrialization8. - Think of CFEngine as an active knowledge management system, rather than as a relatively passive programming framework. @@ -715,7 +696,6 @@ Just as we separate goals from actions, and strategy from tactics, so we can separate what is easy from what is simple. Easy brings short-term gratification, but simple makes the future cost less. - Easyis about barriers to adoption. If there is a cost associated with moving ahead that makes it hard: @@ -738,7 +718,6 @@ and ideas, just more of the same. ### How does complexity affect agility? - In the past[^11], it was common to manage change by making everything the same. Today, the individualized custom experience is what today's information-society craves. Being forced into a single mold is a hindrance to adaptability and @@ -759,12 +738,10 @@ making a risky process _too easy_ can encourage haste and carelessness. Any problem has an intrinsic complexity, which can be measured by the smallest amount of information required to manage it, without loss of control. - * Ease is the absence of a barrier or cost to action. * Simplicity is a strategy for minimizing Total Cost of Ownership. - Making something truly simple is a very hard problem, but it is an investment in future change. What is easy today might be expensive to make easy tomorrow. But if something is truly simple, then the work is all up front in learning the @@ -803,7 +780,6 @@ back by the need to over-simplify. ### An effective understanding helps agility - All configuration issues, including fitness for purpose, boil down to three things: why, what and how. Knowing why we do something is the most important way of avoiding error and risk of failure. Simplicity then comes from keeping the @@ -915,7 +891,6 @@ Footnotes accomplish is to maximize the likelihood of a predictable result, relative to the kind of environment in which we work. - [^5]: In some other configuration software, assumptions are hard-coded into the tools themselves, making the outcome undocumented. diff --git a/content/resources/additional-topics/application-management.markdown b/content/resources/additional-topics/application-management.markdown index c586cfb6c..f068b86ff 100644 --- a/content/resources/additional-topics/application-management.markdown +++ b/content/resources/additional-topics/application-management.markdown @@ -24,7 +24,6 @@ properly customized for use. ## How can CFEngine help? - CFEngine assists with application management in a number of ways. Following the BDMA lifecycle, we note: @@ -50,7 +49,6 @@ BDMA lifecycle, we note: ## Package management - Application management is simple today on most operating systems due to the introduction ofpackage systems. @@ -189,11 +187,9 @@ versioning format of the software, whatever it is, e.g. you would write something like "1.00.00.0" if two digits were used in the two middle version number positions. - CFEngine automatically adapts its versioning to the conventions used by individual package schemas. - To summarize, in order for CFEngine to be able to match installed packages with the ones in the directory repository, the same naming convention must be applied. That is, the package name, version and architecture must have the same @@ -251,7 +247,6 @@ the product name and version (Tables->Property->ProductName and ProductVersion). ## Customizing applications - By definition, we cannot explain how to customize software for all cases. For Unix-like systems however, software customization is usually a matter of editing a configuration text file. CFEngine can edit files, for instance, to add a @@ -313,7 +308,6 @@ processes: commands: - start_me:: "/path/to/software" diff --git a/content/resources/additional-topics/change-management.markdown b/content/resources/additional-topics/change-management.markdown index e168fb15d..b45e6aff0 100644 --- a/content/resources/additional-topics/change-management.markdown +++ b/content/resources/additional-topics/change-management.markdown @@ -128,7 +128,6 @@ changes can be made a quickly as possible, without significant use of resources. CFEngine's lightweight agents can run every five minutes to achieve a tight alignment with operational and business goals. - In information theory, Nyquist's theorem says that, in order to properly track (and potentially correct) a process that happens at rate R, one must sample the system at twice this rate 2R. In CFEngine, we have chosen a repair resolution of @@ -229,8 +228,6 @@ bundle agent example } ``` - - You change a promise you have made about state to promise a new desired state. You edit promises.cf and track the changes using a change management repository @@ -291,7 +288,6 @@ by anything that happens there. You cannot assume that no change will happen. ## Change management and knowledge management - The decision to manage change is an economic trade-off. The more promises we make about state, the higher the cost of keeping them. You have to decide how much you are willing to spend on navigating change. diff --git a/content/resources/additional-topics/cloud-computing.markdown b/content/resources/additional-topics/cloud-computing.markdown index f507f3097..8ce32382e 100644 --- a/content/resources/additional-topics/cloud-computing.markdown +++ b/content/resources/additional-topics/cloud-computing.markdown @@ -128,7 +128,6 @@ approach to continuous maintenance. The approach used by CFEngine is to: - * Help to bring comprehension to the scope of the problem (Knowledge Management and Model-based Desired State Computing). diff --git a/content/resources/additional-topics/content-driven-policy.markdown b/content/resources/additional-topics/content-driven-policy.markdown index a0aa2e75d..64214137b 100644 --- a/content/resources/additional-topics/content-driven-policy.markdown +++ b/content/resources/additional-topics/content-driven-policy.markdown @@ -7,7 +7,6 @@ reviewed: 2019-05-06 ## What is a content-driven policy? - A Content-Driven Policy is a text file with lines containing semi-colon separated fields, like a spreadsheet or tabular file. Each line in the file is parsed and results in a specific type of promise being made, depending on which @@ -35,7 +34,6 @@ Enterprise. ## Why should i use content-driven policies? - As seen in the example above, Content-Driven Policies are easy to write and maintain, especially for users not very familiar with the CFEngine language. They are designed to capture the essence of a specific, popular use of CFEngine, @@ -87,7 +85,6 @@ like the following. ## How do content-driven policies work in detail? - The text files in masterfiles/cdp_inputs/(e.g. 'registry_list.txt') are parsed into CFEngine lists by corresponding cdp_*files in masterfiles/(e.g. 'cdp_registry.cf'). It is the latter set of files that actually implement the @@ -98,7 +95,6 @@ Content-Driven Policies. ## Can I make my own content-driven policies? - It is possible to mimic the structure of the existing Content-Driven Policies to implement new ones, for new purposes. diff --git a/content/resources/additional-topics/devops.markdown b/content/resources/additional-topics/devops.markdown index 13b151dd6..604e9e311 100644 --- a/content/resources/additional-topics/devops.markdown +++ b/content/resources/additional-topics/devops.markdown @@ -17,7 +17,6 @@ speed as agile development teams. ## Why is DevOps happening now? - The proliferation of Free and Open Source software has put powerful software components in the hands of a broader range of developers than ever before - and businesses everywhere are exploiting this software by adapting it and combining @@ -62,7 +61,6 @@ but no simpler. ## How do we make controlled change faster? - It is important to be able to make changes quickly. Automation can implement change quickly if humans can get their acts together. Human IT processes and best practices (e.g. ITIL, COBIT, etc) tend to over bureaucratize change, @@ -174,7 +172,6 @@ bundle agent SomeUserDefinedName } ``` - This is the mechanism by which all decisions are made in CFEngine. Class contexts are evaluated bycf-agentand are cached so that they can be used at any time. diff --git a/content/resources/additional-topics/distributed-scheduling.markdown b/content/resources/additional-topics/distributed-scheduling.markdown index 61645f121..a037ab09b 100644 --- a/content/resources/additional-topics/distributed-scheduling.markdown +++ b/content/resources/additional-topics/distributed-scheduling.markdown @@ -206,7 +206,6 @@ commands: classes => state_repaired("did_my_job"); ``` - ## Fancy distributed encapsulation We could try to be fancy about distributed scheduling, packaging it into a diff --git a/content/resources/additional-topics/file-content.markdown b/content/resources/additional-topics/file-content.markdown index 2d9028fd7..61ea95cd8 100644 --- a/content/resources/additional-topics/file-content.markdown +++ b/content/resources/additional-topics/file-content.markdown @@ -48,7 +48,6 @@ the final destination by cf-agent. ## What does file editing involve? - There are several ways to approach desired state management of file contents: * Copy a finished file template to the desired location, completely overwriting @@ -67,7 +66,6 @@ For the approach Against the approach 2. Deterministic. Limited specialization and must come from a single source, again maintained by hand. 3. Non-deterministic/partial model. Full power to customize file even with multiple managers. - Approaches 1 and 2 are best for situations where very few variations of a file are needed in different circumstances. Approach 3 is best when you need to customize a file significantly, especially when you don't know the full details @@ -349,7 +347,6 @@ delete_lines: ## Constructing files from promises - Making finished templates for files and filling in the blanks using variables is a flexble approach in many cases, but it is not flexible enough for all cases. A very flexible approach, but one that requires more thought, is to build a final @@ -404,7 +401,6 @@ This is a file template containing variables to expand e.g $(data.person) had $(data.animal) ``` - Then we would have the file content: ```console @@ -455,7 +451,6 @@ files: ### Lists inline - Here is a more complicated example, that includes list expansion. List expansion (iteration) adds some trickiness because it is an ordered process, which needs to be anchored somehow. @@ -489,7 +484,6 @@ bundle agent main { files: - "/tmp/my_result" create => "true", @@ -588,7 +582,6 @@ bundle agent main { files: - "/tmp/my_result" create => "true", @@ -663,7 +656,6 @@ bundle agent main { files: - "/tmp/my_result" create => "true", diff --git a/content/resources/additional-topics/iteration.markdown b/content/resources/additional-topics/iteration.markdown index d99ecf472..93a94b9d9 100644 --- a/content/resources/additional-topics/iteration.markdown +++ b/content/resources/additional-topics/iteration.markdown @@ -87,7 +87,6 @@ continue with more compelling examples. ## Iterating across multiple lists - Although iteration is a powerful concept in and of itself, CFEngine can iterate across multiple lists simultaneously. In the previous example, we looked at the current values of four monitor variables, but since CFEngine also gives us diff --git a/content/resources/additional-topics/itil.markdown b/content/resources/additional-topics/itil.markdown index 15b903692..3cdfb8cd2 100644 --- a/content/resources/additional-topics/itil.markdown +++ b/content/resources/additional-topics/itil.markdown @@ -6,7 +6,6 @@ sorting: 80 ## What it ITIL? - The IT Infrastructure Library (ITIL) is a set of human management practices surrounding IT infrastructure that are designed to bring quality assurance and continuous improvement to organizations. ITIL has emerged as a de-facto set of @@ -28,10 +27,8 @@ Whether this means a centralization or decentralization of IT management in the end, depends on the concrete instances of ITIL processes in the respective scenario. - ## ITIL history and versions - ITIL has its roots in the early 1990s, and since then was subject to numerous improvements and enhancements. Today, the most popular release of ITIL is given by the books of ITIL version 2 (often referred to as ITILv2), while the British @@ -46,10 +43,8 @@ with respect to the issue of IT strategies, IT-business-alignment and continual improvement. In the following, we run through the basics of both versions, highlighting commonalities and differences. - ## Basics - ITIL is an attempt to implement theDeming Quality Circleas a model for continual quality improvement. Quality relates to the provided IT services as well as the management processes deployed to manage these services. Continual improvement in @@ -93,7 +88,6 @@ dealing with unpredictable situations. ## Version 3 - In 2007, version 2 was replaced by its successor version 3, aimed at covering the entire service life cycle from a management perspective and striving for a more substantiated idea of IT business alignment. Many version 2 processes and @@ -257,10 +251,8 @@ mean regular on a time-scale that is representative for the service being provided, e.g. reviews once per week, once per month? No one can tell you about your needs. You have to decide this from local needs. - ## Tool support - In the field of tool support for IT Service Management accordant to ITIL, various white papers and studies have been published. In addition, there are papers available from BMC, HP, IBM and other vendors that describe specific @@ -394,7 +386,6 @@ already shared objects, such as shared storage. * CMDB Asset Management - Why bother to collect an inventory of this kind? Is it bureaucracy gone mad, or do we need it for insurance purposes? Both of these things are of course possibilities. @@ -462,7 +453,6 @@ circumstances to an earlier state - they are beyond our control. ### Release management - A release in ITIL is a collection of authorized changes to a system. One part of Change Management is thereforeRelease Management. A release is generally a larger umbrella under which many smaller changes are made. It is major change. @@ -498,7 +488,6 @@ problems, we are in trouble! ### Service Level Management (SLM) - Also loosely referred to as Quality of Service. This is the process of making sure that Service Level Promises are kept, or Service Level Agreements (SLA) are adhered to. We must assess the impact of changes on the ability to deliver on @@ -506,7 +495,6 @@ promises. ## Using CFEngine to implement ITIL objectives - How does CFEngine fit into the management of a service organization? There are several ways: @@ -532,7 +520,6 @@ words, CFEngine is itself part of the infrastructure that we might change. ## How can CFEngine or promises help an enterprise - Traditional methods of managing IT infrastructure involve working from crisis to crisis - waiting for `incidents` to occur and then initiating fire suppression responses or, if there is time, proactive changes. With CFEngine, these can be diff --git a/content/resources/additional-topics/modularity.markdown b/content/resources/additional-topics/modularity.markdown index d8bb9e62f..16438aeea 100644 --- a/content/resources/additional-topics/modularity.markdown +++ b/content/resources/additional-topics/modularity.markdown @@ -609,7 +609,6 @@ files: create => "true", classes => set_outcome_classes; - reports: got_did_task_one:: @@ -803,7 +802,6 @@ commands: "/bin/shutdown now"; } - ####################################################### bundle server my_access_rules() @@ -952,7 +950,6 @@ files: ############################################################ - bundle server my_access_rules() { access: @@ -1160,7 +1157,6 @@ reports: ############################################################ - bundle server my_access_rules() { access: @@ -1175,7 +1171,6 @@ access: } - body printfile visitors_book(file) { file_to_print => "$(file)"; @@ -1372,7 +1367,6 @@ methods: classes => if_repaired("send_the_dragon_back_from_$(satellite)"), if => "cue_action_on_$(satellite)"; - files: # hub/lair hub signs the book too and schedules the dragon for next satellite @@ -1415,7 +1409,6 @@ reports: " X Switching new dragon's target $(name)"; } - ############################################################ bundle edit_line sign_visitor_book(s) @@ -1431,7 +1424,6 @@ insert_lines: ############################################################ - bundle server my_access_rules() { access: diff --git a/content/resources/additional-topics/open-nebula.markdown b/content/resources/additional-topics/open-nebula.markdown index e23a98887..1c55d0a0c 100644 --- a/content/resources/additional-topics/open-nebula.markdown +++ b/content/resources/additional-topics/open-nebula.markdown @@ -41,7 +41,6 @@ lifecycle, Open Nebula and CFEngine will play different roles. characteristics over time. These may be collected in CFEngine's reporting interface or Mission Portal. - Open Nebula's focus is on managing the deployment and recycling of the computing infrastructure. CFEngine picks up where Open Nebula leaves off and manages the dynamic lifecycle of software, applications and runtime state. @@ -57,7 +56,6 @@ assumptions serve as an example and should be altered to fit your needs: * The CFEngine policy hub is running on the Open nebula front end. * NFS will be used to share virtual machine images between hosts. - Open nebula requires a single front-end machine and one or more node controllers. The front end is a management machine that is used to monitor and issue commands to the node controllers. Node controllers provide virtual machine @@ -70,7 +68,6 @@ cluster-node. ### Installation and dependancy configuration - First we can classify the physical machines in this case by IP address: ```cf3 @@ -79,13 +76,11 @@ classes: "node_controllers" or => {"192.168.1.3"}; ``` - If we want multiple node controllers then we can instead setup an slist variable IP addresses of intended node controllers. This will allow the "onehost create" command to execution each new node controller in turn reducing redundancy in the policy file for example: - ```cf3 vars: "node_controller" slist => { "192.168.1.3", "192.168.1.4", "192.168.1.5" }; @@ -94,7 +89,6 @@ commands: "/usr/bin/onehost create $(node_controller) im_kvm vmm_kvm tm_nfs", contain => oneadmin; - classes: "policy_host" or => { @@ -103,7 +97,6 @@ classes: }; ``` - To install the dependancies for each physical machine we can define these in a list and use the CFEngine standard library package promises to install them: @@ -152,12 +145,10 @@ node_controller:: package_method => generic; ``` - The additional line in the front end dependancy installation promise, assuming a successful installation, will ensure the Open Nebula daemon is running at all times: - ```cf3 front_end:: @@ -168,7 +159,6 @@ ensure_opennebula_running:: Resulting in: - ```cf3 commands: @@ -178,11 +168,9 @@ commands: contain => oneadmin; ``` - Since we will be using Open Nebula version 2 we must manually supply the package: - ```cf3 commands: @@ -210,7 +198,6 @@ contain body by appending the following to commands promises: contain => oneadmin ``` - This will in turn apply owner and group permissions of the oneadmin user: ```cf3 @@ -224,7 +211,6 @@ body contain oneadmin Next: Open Nebula environment configuration, Previous: Installation and dependancy configuration, Up: Top NFS config for shared image repository - If not present append the NFS export directory stored in the corresponding variable (including a new line): diff --git a/content/resources/additional-topics/security.markdown b/content/resources/additional-topics/security.markdown index fb10d17b2..25e3f266d 100644 --- a/content/resources/additional-topics/security.markdown +++ b/content/resources/additional-topics/security.markdown @@ -62,7 +62,6 @@ aggregation for convenience however. Figure: A policy server or `hub` is implemented in CFEngine Nova as a simple solution that will scale for most sites out of the box. - If you operate CFEngine Nova in its default mode, the hub acts as a server from which every other client machine can access policy updates. It also acts as a collector, aggregating summary information from each machine and weaving it into @@ -82,11 +81,9 @@ tested and approved, it will be copied manually to the policy dispatch point on one or more distribution servers. All other machines will then download policy updates from that single location according to their own schedule. - Figure: Policy coordinated from a central root location is implemented in a distributed manner at every leaf node. - ### Robustness to failure If an agent receives a policy proposal that is badly formed or in some way @@ -115,7 +112,6 @@ oriented architecture, i.e. a weak coupling. ### What is security? - The concept of security, while various in its interpretation and intented use, is related to a feeling of safety. No system is completely safe from every threat, thus no system can promise complete security. Security is ultimately diff --git a/content/resources/additional-topics/teamwork.markdown b/content/resources/additional-topics/teamwork.markdown index 08358c14c..02e316df4 100644 --- a/content/resources/additional-topics/teamwork.markdown +++ b/content/resources/additional-topics/teamwork.markdown @@ -6,7 +6,6 @@ sorting: 80 ## What is team-work? - Team work is a collaboration between individuals with different skills. It is key element in decentralized organization - both for humans and computers. @@ -39,7 +38,6 @@ responsible for what role, and to what extent. ## Creative roles - M. Belbin, a researcher in teamwork has identified nine abilities or roles (kinds of promise) to be played in a team collaboration (regardless of how many people there are in the team): @@ -80,7 +78,6 @@ this problem is what CFEngine is about. ## Delegating roles in a collaboration - We need to delegate responsiblity to divide and conquer a problem, both when designing policy for computers and when making work schedules for humans. But how can we be certain different parties will not interfere with one anothers' diff --git a/content/resources/best-practices.markdown b/content/resources/best-practices.markdown index bb0ad1efd..c30e7f750 100644 --- a/content/resources/best-practices.markdown +++ b/content/resources/best-practices.markdown @@ -60,7 +60,6 @@ When running CFEngine Enterprise in a large-scale IT environment with many thous With CFEngine 3.6, significant testing was performed to identify the issues surrounding scalability and to determine best practices in large-scale installations of CFEngine. - ### Moving PostgreSQL to separate hard drive Moving the PostgreSQL database to another physical hard drive from the other CFEngine components can improve the stability of large-scale installations, particularly when using a solid-state drive (SSD) for hosting the PostgreSQL database. diff --git a/content/resources/faq/integrate-custom-policy.markdown b/content/resources/faq/integrate-custom-policy.markdown index 3d2990ba6..44dbf6eea 100644 --- a/content/resources/faq/integrate-custom-policy.markdown +++ b/content/resources/faq/integrate-custom-policy.markdown @@ -29,7 +29,7 @@ in inputs of body common control in promises.cf by default. ```json { - "inputs": [ "my_update.cf" ] + "inputs": ["my_update.cf"] } ``` @@ -37,9 +37,7 @@ Alternatively you can define `augments_inputs` directly. ```json { - "vars": { - "augments_inputs": [ "my_policy.cf" ] - } + "vars": { "augments_inputs": ["my_policy.cf"] } } ``` @@ -47,9 +45,7 @@ To extend inputs in the update policy define `update_inputs`. ```json { - "vars": { - "update_inputs": [ "my_update.cf" ] - } + "vars": { "update_inputs": ["my_update.cf"] } } ``` diff --git a/content/resources/faq/mustache-templating.markdown b/content/resources/faq/mustache-templating.markdown index 92df41f74..9f353d75a 100644 --- a/content/resources/faq/mustache-templating.markdown +++ b/content/resources/faq/mustache-templating.markdown @@ -35,12 +35,10 @@ This template should not be passed a data container; it uses the `datastate()` of the CFEngine system. That's where `classes.enterprise` and `vars.sys.cf_version` came from. - ``` Version: CFEngine {{#classes.enterprise}}Enterprise{{/classes.enterprise}} {{vars.sys.cf_version}} ``` - ## How do I render a section only if a given class is not defined? In the mustache documentation this is referred to as an *inverted section*. @@ -53,12 +51,10 @@ This template should not be passed a data container; it uses the `datastate()` of the CFEngine system. That's where `classes.cfengine_enterprise` and `vars.sys.cf_version` came from. - ``` Version: CFEngine {{#classes.cfengine_enterprise}}Enterprise{{/classes.cfengine_enterprise}}{{^classes.cfengine_enterprise}}Community{{/classes.cfengine_enterprise}} {{vars.sys.cf_version}} ``` - ## How do I use class expressions? Mustache does not understand CFEngine's class expression logic and it is not @@ -66,31 +62,25 @@ possible to use full class expressions in mustache templates. Instead, use class expressions inside CFEngine policy to define a singular class which can be used to conditionally render a block. - [%CFEngine_include_example(mustache_classes.cf)%] - ## How do I iterate over a list? This template should not be passed a data container; it uses the `datastate()` of the CFEngine system. That's where `vars.mon.listening_tcp4_ports` came from. - ``` {{#vars.mon.listening_tcp4_ports}} * {{.}} {{/vars.mon.listening_tcp4_ports}} ``` - ## How can I access keys when iterating over a dict? In CFEngine, the `@` symbol expands to the current key when iterating over a dict. - [%CFEngine_include_example(mustache_extension_expand_key.cf)%] - ## Can you use nested classes? You can. This is handy when options slightly differ for different operating systems. @@ -98,7 +88,6 @@ In this example for ssh daemon the authorized key configuration will only be add class `SSH_LDAP_PUBKEY_BUNDLE` is true and for the class debian/centos diffenrent keywords are added. - ``` {{#classes.SSH_LDAP_PUBKEY_BUNDLE}} {{#classes.debian}} diff --git a/content/resources/faq/what-did-cfengine-change.markdown b/content/resources/faq/what-did-cfengine-change.markdown index ec649d729..63663b9e8 100644 --- a/content/resources/faq/what-did-cfengine-change.markdown +++ b/content/resources/faq/what-did-cfengine-change.markdown @@ -131,7 +131,6 @@ verbose: No lock purging scheduled verbose: Outcome of version (not specified) (agent-0): Promises observed - Total promise compliance: 0% kept, 100% repaired, 0% not kept (out of 2 events). User promise compliance: 0% kept, 100% repaired, 0% not kept (out of 2 events). CFEngine system compliance: 0% kept, 0% repaired, 0% not kept (out of 0 events). ``` - ### Promise logging Promises can be configured to [log their outcomes][Promise types#log_repaired] @@ -195,43 +194,43 @@ Example response: ```json { - "data": [ - { - "bundlename": "cfe_internal_update_policy", - "changetime": 1512427971, - "hostkey": "SHA=01fe75e93ca88bbd381eb720e9b43d0840ea8727aae8fc84391c297c42798f5c", - "hostname": "hub", - "logmessages": [ - "Copying from 'localhost:/var/cfengine/masterfiles/cf_promises_release_id'" - ], - "policyfile": "/var/cfengine/inputs/cfe_internal/update/update_policy.cf", - "promisees": [], - "promisehandle": "cfe_internal_update_policy_files_inputs_dir", - "promiser": "/var/cfengine/inputs", - "promisetype": "files", - "stackpath": "/default/cfe_internal_update_policy/files/'/var/cfengine/inputs'[1]" - }, - { - "bundlename": "cfe_internal_setup_knowledge", - "changetime": 1512428912, - "hostkey": "SHA=01fe75e93ca88bbd381eb720e9b43d0840ea8727aae8fc84391c297c42798f5c", - "hostname": "hub", - "logmessages": [ - "Owner of '/var/cfengine/httpd/htdocs/application/logs/./log-2017-12-04.log' was 0, setting to 497", - "Group of '/var/cfengine/httpd/htdocs/application/logs/./log-2017-12-04.log' was 0, setting to 497", - "Object '/var/cfengine/httpd/htdocs/application/logs/./log-2017-12-04.log' had permission 0644, changed it to 0640" - ], - "policyfile": "/var/cfengine/inputs/cfe_internal/enterprise/CFE_knowledge.cf", - "promisees": [], - "promisehandle": "cfe_internal_setup_knowledge_files_doc_root_application_logs", - "promiser": "/var/cfengine/httpd/htdocs/application/logs/.", - "promisetype": "files", - "stackpath": "/default/cfe_internal_management/methods/'CFEngine_Internals'/default/cfe_internal_enterprise_main/methods/'hub'/default/cfe_internal_setup_knowledge/files/'/var/cfengine/httpd/htdocs/application/logs/.'[1]" - } - ], - "total": 2, - "next": null, - "previous": null + "data": [ + { + "bundlename": "cfe_internal_update_policy", + "changetime": 1512427971, + "hostkey": "SHA=01fe75e93ca88bbd381eb720e9b43d0840ea8727aae8fc84391c297c42798f5c", + "hostname": "hub", + "logmessages": [ + "Copying from 'localhost:/var/cfengine/masterfiles/cf_promises_release_id'" + ], + "policyfile": "/var/cfengine/inputs/cfe_internal/update/update_policy.cf", + "promisees": [], + "promisehandle": "cfe_internal_update_policy_files_inputs_dir", + "promiser": "/var/cfengine/inputs", + "promisetype": "files", + "stackpath": "/default/cfe_internal_update_policy/files/'/var/cfengine/inputs'[1]" + }, + { + "bundlename": "cfe_internal_setup_knowledge", + "changetime": 1512428912, + "hostkey": "SHA=01fe75e93ca88bbd381eb720e9b43d0840ea8727aae8fc84391c297c42798f5c", + "hostname": "hub", + "logmessages": [ + "Owner of '/var/cfengine/httpd/htdocs/application/logs/./log-2017-12-04.log' was 0, setting to 497", + "Group of '/var/cfengine/httpd/htdocs/application/logs/./log-2017-12-04.log' was 0, setting to 497", + "Object '/var/cfengine/httpd/htdocs/application/logs/./log-2017-12-04.log' had permission 0644, changed it to 0640" + ], + "policyfile": "/var/cfengine/inputs/cfe_internal/enterprise/CFE_knowledge.cf", + "promisees": [], + "promisehandle": "cfe_internal_setup_knowledge_files_doc_root_application_logs", + "promiser": "/var/cfengine/httpd/htdocs/application/logs/.", + "promisetype": "files", + "stackpath": "/default/cfe_internal_management/methods/'CFEngine_Internals'/default/cfe_internal_enterprise_main/methods/'hub'/default/cfe_internal_setup_knowledge/files/'/var/cfengine/httpd/htdocs/application/logs/.'[1]" + } + ], + "total": 2, + "next": null, + "previous": null } ``` @@ -277,7 +276,7 @@ path), and the timestamp of the agent ran. Here is an example of the output in `promise_log.jsonl`: -```json +```json {skip} { "execution": { "bundle":"file_make_mustache", diff --git a/content/web-ui/_index.markdown b/content/web-ui/_index.markdown index af880706e..9a77faaf0 100644 --- a/content/web-ui/_index.markdown +++ b/content/web-ui/_index.markdown @@ -90,7 +90,6 @@ All Events can be searched and viewed from the Event Log page. Mission Portal - Events View whole system events RBAC page - ### Newly bootstrapped hosts widget The Newly bootstrapped hosts widget helps to visualize the number of hosts bootstrapped to CFEngine over time. diff --git a/content/web-ui/alerts-and-notifications.markdown b/content/web-ui/alerts-and-notifications.markdown index a8a29cdc3..cbe5a939f 100644 --- a/content/web-ui/alerts-and-notifications.markdown +++ b/content/web-ui/alerts-and-notifications.markdown @@ -10,12 +10,10 @@ sorting: 40 * When the cursor is hovering over top, an **Add** button will appear. - New Alerts * Click the button to begin creating the alert. - New Alerts Name * Add a unique name for the alert. @@ -25,21 +23,18 @@ sorting: 40 * **Medium**: Orange * **High**: Red - New Alerts Severity * From the **Severity** dropdown box, select one of the three options available. * The **Select Condition** drop down box represents an inventory of existing conditional rules, as well as an option to create a new one - New Alerts Condition * When selecting an existing conditional rule, the name of the condition will automatically populate the mandatory condition **Name** field. * When creating a new condition the **Name** field must be filled in. - New Alerts Condition Type * Each alert also has a **Condition type**: @@ -57,7 +52,6 @@ sorting: 40 * Notifications of alerts may be sent by email or custom action scripts. - New Alerts Notifications * Check **Email notifications** box to activate the field for entering the email address to notify. diff --git a/content/web-ui/custom-actions-for-alerts.markdown b/content/web-ui/custom-actions-for-alerts.markdown index a9493238f..98102fefe 100644 --- a/content/web-ui/custom-actions-for-alerts.markdown +++ b/content/web-ui/custom-actions-for-alerts.markdown @@ -10,13 +10,11 @@ This is where the Custom actions come in. A Custom action is a way to execute a Any scripting language may be used, as long as the hub has an interpreter for it. - ## Alert parameters The Custom action script gets called with one parameter: the path to a file with a set of KEY=VALUE lines. Most of the keys are common for all alerts, but some additional keys are defined based on the alert type, as shown below. - ### Common keys These keys are present for all alert types. @@ -36,8 +34,6 @@ These keys are present for all alert types. | ALERT_CONDITION_DESCRIPTION | Condition description, as defined when creating the alert (string). | | ALERT_CONDITION_TYPE | Type, as selected when creating the alert. Can be 'policy', 'inventory', or 'softwareupdate'. | - - ### Policy keys In addition to the common keys, the following keys are present when ALERT_CONDITION_TYPE='policy'. @@ -49,7 +45,6 @@ In addition to the common keys, the following keys are present when ALERT_CONDIT | ALERT_POLICY_CONDITION_PROMISEHANDLE | Promise handle to filter by, as defined when creating the alert (string). | | ALERT_POLICY_CONDITION_PROMISEOUTCOME | Promise outcome to filter by, as selected when creating the alert. Can be either 'KEPT', 'REPAIRED' or 'NOTKEPT'. | - ### Inventory keys In addition to the common keys, the following keys are present when ALERT_CONDITION_TYPE='inventory'. @@ -69,7 +64,6 @@ In addition to the common keys, the following keys are present when ALERT_CONDIT | ALERT_SOFTWARE_UPDATE_CONDITION_PATCHNAME | The name of the package, as defined when creating the alert, or empty if undefined (string). | | ALERT_SOFTWARE_UPDATE_CONDITION_PATCHARCHITECTURE | The architecture of the package, as defined when creating the alert, or empty if undefined (string). | - ## Example parameters: policy bundle alert not kept Given an alert that triggers on a policy bundle being not kept (failed), the following is example content of the file being provided as an argument to a Custom action script. @@ -99,7 +93,6 @@ You could then simply test your Custom action script, e.g. 'cfengine_custom_acti When you get this to work as expected on the commmand line, you are ready to upload the script to the Mission Portal, as outlined below. - ## Example script: logging policy alert to syslog The following Custom action script will log the status and definition of a policy alert to syslog. @@ -123,8 +116,6 @@ What gets logged to syslog depends on which alert is associated with the script, Sep 26 02:00:53 localhost user[18823]: Policy alert 'Web service' fail. Now triggered on 11 hosts. Defined with bundlename='web_service', promise handle '' and outcome NOTKEPT - - ## Uploading the script to the Mission Portal Members of the admin role can manage Custom action scripts in the Mission Portal settings. @@ -135,7 +126,6 @@ A new script can be uploaded, together with a name and description, which will b Adding Custom action syslog script - ## Associating a Custom action with an alert Alerts can have any number of Custom action scripts as well as an email notification associated with them. This can be configured during alert creation. Note that for security reasons, only members of the admin role may associate alerts with Custom action scripts. diff --git a/content/web-ui/debugging-mission-portal.markdown b/content/web-ui/debugging-mission-portal.markdown index 0702acf00..cd8866f4f 100644 --- a/content/web-ui/debugging-mission-portal.markdown +++ b/content/web-ui/debugging-mission-portal.markdown @@ -8,8 +8,7 @@ sorting: 90 2. Edit `/var/cfengine/share/GUI/index.php` and set `ENVIRONMENT` to `development` - ```php - [file=/var/cfengine/share/GUI/index.php] + ```php {file="/var/cfengine/share/GUI/index.php"} define('ENVIRONMENT', 'development'); ``` diff --git a/content/web-ui/enterprise-reporting/client-initiated-reporting.markdown b/content/web-ui/enterprise-reporting/client-initiated-reporting.markdown index e2b1280ab..b1c99e54f 100644 --- a/content/web-ui/enterprise-reporting/client-initiated-reporting.markdown +++ b/content/web-ui/enterprise-reporting/client-initiated-reporting.markdown @@ -20,12 +20,10 @@ The easiest way to enable call collect is via augments files, modify `/var/cfeng ```json {file="def.json"} { - "classes": { - "client_initiated_reporting_enabled": [ "any" ] - }, + "classes": { "client_initiated_reporting_enabled": ["any"] }, "vars": { - "mpf_access_rules_collect_calls_admit_ips": [ "0.0.0.0/0" ], - "control_hub_exclude_hosts": [ "0.0.0.0/0" ] + "mpf_access_rules_collect_calls_admit_ips": ["0.0.0.0/0"], + "control_hub_exclude_hosts": ["0.0.0.0/0"] } } ``` diff --git a/content/web-ui/enterprise-reporting/reporting-architecture.markdown b/content/web-ui/enterprise-reporting/reporting-architecture.markdown index 7be7a01e5..4f82231a1 100644 --- a/content/web-ui/enterprise-reporting/reporting-architecture.markdown +++ b/content/web-ui/enterprise-reporting/reporting-architecture.markdown @@ -16,7 +16,6 @@ background, and is started by `cf-agent` and from the init scripts. `cf-hub` wakes up every 5 minutes and connects to the `cf-serverd` of each host to download new data. - To collect reports from any host manually, run the following: ```command diff --git a/content/web-ui/federated-reporting.markdown b/content/web-ui/federated-reporting.markdown index 0ae294a2e..416f12702 100644 --- a/content/web-ui/federated-reporting.markdown +++ b/content/web-ui/federated-reporting.markdown @@ -41,9 +41,7 @@ federation policy to ensure that `semanage` is installed. ```json { - "classes": { - "cfengine_mp_fr_dependencies_auto_install" : ["any"] - } + "classes": { "cfengine_mp_fr_dependencies_auto_install": ["any"] } } ``` @@ -208,9 +206,7 @@ After those steps, ensure `cfengine_mp_fr_enable_distributed_cleanup` is present ```json { - "classes": { - "cfengine_mp_fr_enable_distributed_cleanup": ["any::"] - } + "classes": { "cfengine_mp_fr_enable_distributed_cleanup": ["any::"] } } ``` (Note that this augment should be in addition to any others that you need such as `cfengine_mp_fr_dependencies_auto_install`) @@ -250,9 +246,7 @@ If enabled it is performed on every import cycle. ```json { - "classes": { - "cfengine_mp_fr_handle_duplicate_hostkeys": ["any::"] - } + "classes": { "cfengine_mp_fr_handle_duplicate_hostkeys": ["any::"] } } ``` @@ -625,8 +619,7 @@ you wish to disable and change the top-level `target_state` property value to `o "role": "feeder", "enabled": "true", "target_state": "off", - "transport": - { + "transport": { "mode": "pull_over_rsync", "ssh_user": "cftransport", "ssh_host": "", @@ -648,7 +641,7 @@ management app. curl -k -s -X GET -u admin:$PASSWORD https://$SUPERHUB/api/fr/remote-hub | jq '.' ``` - ```json + ```json {skip} { "id": 1, "hostkey": "SHA=cd4be31f20f0c7d019a5d3bfe368415f2d34fec8af26ee28c4c123c6a0af49a2", @@ -730,7 +723,7 @@ we use the number "1". If you wish to re-add this feeder to a superhub, change "target_state" from "off" to "on". Remember to trigger or wait for an agent run for the change from off to on to take effect. - ```json + ```json {skip TODO} { "hostname": null, "role": "feeder", @@ -739,7 +732,6 @@ we use the number "1". } ``` - * On 3.15.x and greater feeders, also run the following commands to truncate two tables: ```console @@ -804,7 +796,7 @@ Follow this procedure: * edit `/opt/cfengine/federation/cfapache/federation-config.json` to remove all entries in the `remote_hubs` property. similar to the following: - ```json + ```json {skip TODO} { "hostname": null, "role": "feeder", diff --git a/content/web-ui/health.markdown b/content/web-ui/health.markdown index 7cf281145..6b6914ad3 100644 --- a/content/web-ui/health.markdown +++ b/content/web-ui/health.markdown @@ -15,6 +15,5 @@ You can get quick access to the health of hosts, including direct links to repor * Duplicate IDs : CFEngine hosts are identified by the CFEngine key they use. If two or more hosts use the same key the reports will be very unreliable. This is detected by exchanging randomized cookies(tokens) during report collections. If a client sends a mismatching cookie (compared to last collection), it indicates that multiple hosts are using the same ID. * Duplicate hostnames: multiple host identities reporting the same host identifier (by default hostname derived from `default:sys.fqhost` variable but changeable in Settings -> Host identifier) - These categories are non-overlapping, meaning a host will only appear in one category at at time even if conditions satisfying multiple categories might be present. This makes reports simpler to read, and makes it easier to detect and fix the root cause of the issue. As one issue is resolved the host might then move to another category. Regardless of the situation, the data from the host will be from the latest report collection, representing the most recent known state of the host. diff --git a/content/web-ui/hub_administration/enable-plain-http.markdown b/content/web-ui/hub_administration/enable-plain-http.markdown index 4e081f0ae..ced98e21d 100644 --- a/content/web-ui/hub_administration/enable-plain-http.markdown +++ b/content/web-ui/hub_administration/enable-plain-http.markdown @@ -13,9 +13,6 @@ masterfiles. ```json {file="def.json"} { - "classes": { - "cfe_enterprise_enable_plain_http": [ "any" ] - } - + "classes": { "cfe_enterprise_enable_plain_http": ["any"] } } ``` diff --git a/content/web-ui/hub_administration/extending-mission-portal.markdown b/content/web-ui/hub_administration/extending-mission-portal.markdown index 36de67e87..30cbc46f6 100644 --- a/content/web-ui/hub_administration/extending-mission-portal.markdown +++ b/content/web-ui/hub_administration/extending-mission-portal.markdown @@ -29,7 +29,6 @@ Upload html files into items will appear named for each html file where underscores are replaced with spaces. Files must be readable by the `cfapache` user. - ### Example File `test_documentation.html` was uploaded to the directory specified above. diff --git a/content/web-ui/hub_administration/extending-query-builder.markdown b/content/web-ui/hub_administration/extending-query-builder.markdown index cf0290a95..6606b4874 100644 --- a/content/web-ui/hub_administration/extending-query-builder.markdown +++ b/content/web-ui/hub_administration/extending-query-builder.markdown @@ -84,7 +84,6 @@ Below you can see an example of hosts table representation as JSON element. } ``` - **Structure:** Each element has a key and a value. When you create your own JSON element please use a unique key. The value is a @@ -126,7 +125,6 @@ After dca.js editing please validate the content of DCA variable (`var DCA =`) i there are many online tools to do that. Once your content validated and file has saved your changes will appear after the next agent run. - #### Example Let's see an example of Query builder extending with a new test table. diff --git a/content/web-ui/hub_administration/policy-deployment.markdown b/content/web-ui/hub_administration/policy-deployment.markdown index 05d9aabda..1778bfed7 100644 --- a/content/web-ui/hub_administration/policy-deployment.markdown +++ b/content/web-ui/hub_administration/policy-deployment.markdown @@ -103,9 +103,7 @@ Create `def.json` in the root of your masterfiles with the following content: ```json {file="def.json"} { - "classes": { - "cfengine_internal_masterfiles_update": [ "hub" ] - } + "classes": { "cfengine_internal_masterfiles_update": ["hub"] } } ``` diff --git a/content/web-ui/hub_administration/public-key-distribution.markdown b/content/web-ui/hub_administration/public-key-distribution.markdown index 76c87786a..0bc0a3734 100644 --- a/content/web-ui/hub_administration/public-key-distribution.markdown +++ b/content/web-ui/hub_administration/public-key-distribution.markdown @@ -25,7 +25,6 @@ less). This policy shows how public keys can be stored in a central location on the policy server and automatically installed on all hosts. - ```cf3 {file="trust_distkeys.cf"} bundle agent trust_distkeys #@ brief Example public key distribution diff --git a/content/web-ui/hub_administration/reset-admin-creds.markdown b/content/web-ui/hub_administration/reset-admin-creds.markdown index 88e71be90..e16df89b4 100644 --- a/content/web-ui/hub_administration/reset-admin-creds.markdown +++ b/content/web-ui/hub_administration/reset-admin-creds.markdown @@ -5,7 +5,6 @@ title: Reset administrative credentials The default `admin` user can be reset to defaults using the following SQL. - ```sql {file="cfsettings-setadminpassword.sql"} INSERT INTO "users" ("username", "password", "salt", "name", "email", "external", "active", "roles", "changetimestamp") SELECT 'admin', 'SHA=aa459b45ecf9816d472c2252af0b6c104f92a6faf2844547a03338e42e426f52', 'eWAbKQmxNP', 'admin', 'admin@organisation.com', false, '1', '{admin,cf_remoteagent}', now() @@ -59,7 +58,6 @@ These credentials are used by PHP CLI scripts to authenticate to the backend API If these credentials are out of sync or incorrect you will see errors like "500 Internal Server Error" in `/var/cfengine/httpd/logs/application/` logs. - Execute the following shell script to rotate and synchronize the CFE Robot credentials and then restart the system with `systemctl restart cfengine3` or similar. ```bash {file="rotate_cfrobot_credentials.sh"} diff --git a/content/web-ui/settings.markdown b/content/web-ui/settings.markdown index 076e263c2..dad91d9ba 100644 --- a/content/web-ui/settings.markdown +++ b/content/web-ui/settings.markdown @@ -229,7 +229,6 @@ To restore the CFEngine admin role permissions run the following sql as root on **See also:** [Web RBAC API][Web RBAC API] - ## About CFEngine About CFEngine diff --git a/scripts/markdown-code-checker.py b/scripts/markdown-code-checker.py deleted file mode 100644 index af8bdf84a..000000000 --- a/scripts/markdown-code-checker.py +++ /dev/null @@ -1,289 +0,0 @@ -from cfbs.pretty import pretty_file -from cfbs.utils import user_error -import json -from shutil import which -import markdown_it -import os -import argparse -import subprocess - - -def extract_inline_code(path, languages): - """extract inline code, language and filters from markdown""" - - with open(path, "r") as f: - content = f.read() - - md = markdown_it.MarkdownIt("commonmark") - ast = md.parse(content) - - for child in ast: - - if child.type != "fence": - continue - - if not child.info: - continue - - info_string = child.info.split() - language = info_string[0] - flags = info_string[1:] - - if language in languages: - yield { - "language": language, - "flags": flags, - "first_line": child.map[0], - "last_line": child.map[1], - } - - -ignored_dirs = [".git"] - - -def get_markdown_files(start, languages): - """locate all markdown files and call extract_inline_code on them""" - - if os.path.isfile(start): - return { - "files": { - start: {"code-blocks": list(extract_inline_code(start, languages))} - } - } - - return_dict = {"files": {}} - for root, dirs, files in os.walk(start): - dirs[:] = [d for d in dirs if d not in ignored_dirs] - - for f in files: - if f.endswith(".markdown") or f.endswith(".md"): - path = os.path.join(root, f) - return_dict["files"][path] = { - "code-blocks": list(extract_inline_code(path, languages)) - } - - return return_dict - - -def extract(origin_path, snippet_path, _language, first_line, last_line): - - try: - with open(origin_path, "r") as f: - content = f.read() - - code_snippet = "\n".join(content.split("\n")[first_line + 1 : last_line - 1]) - - with open(snippet_path, "w") as f: - f.write(code_snippet) - except IOError: - user_error(f"Couldn't open '{origin_path}' or '{snippet_path}'") - - -def check_syntax(origin_path, snippet_path, language, first_line, _last_line): - snippet_abs_path = os.path.abspath(snippet_path) - - if not os.path.exists(snippet_path): - user_error( - f"Couldn't find the file '{snippet_path}'. Run --extract to extract the inline code." - ) - - match language: - case "cf": - try: - p = subprocess.run( - ["/var/cfengine/bin/cf-promises", snippet_abs_path], - capture_output=True, - text=True, - ) - err = p.stderr - - if err: - err = err.replace(snippet_abs_path, f"{origin_path}:{first_line}") - print(err) - except OSError: - user_error(f"'{snippet_abs_path}' doesn't exist") - except ValueError: - user_error("Invalid subprocess arguments") - except subprocess.CalledProcessError: - user_error(f"Couldn't run cf-promises on '{snippet_abs_path}'") - except subprocess.TimeoutExpired: - user_error("Timed out") - - -def check_output(): - pass - - -def replace(origin_path, snippet_path, _language, first_line, last_line): - - try: - with open(snippet_path, "r") as f: - pretty_content = f.read() - - with open(origin_path, "r") as f: - origin_lines = f.read().split("\n") - pretty_lines = pretty_content.split("\n") - - offset = len(pretty_lines) - len( - origin_lines[first_line + 1 : last_line - 1] - ) - - origin_lines[first_line + 1 : last_line - 1] = pretty_lines - - with open(origin_path, "w") as f: - f.write("\n".join(origin_lines)) - except FileNotFoundError: - user_error( - f"Couldn't find the file '{snippet_path}'. Run --extract to extract the inline code." - ) - except IOError: - user_error(f"Couldn't open '{origin_path}' or '{snippet_path}'") - - return offset - - -def autoformat(_origin_path, snippet_path, language, _first_line, _last_line): - - match language: - case "json": - try: - pretty_file(snippet_path) - except FileNotFoundError: - user_error( - f"Couldn't find the file '{snippet_path}'. Run --extract to extract the inline code." - ) - except PermissionError: - user_error(f"Not enough permissions to open '{snippet_path}'") - except IOError: - user_error(f"Couldn't open '{snippet_path}'") - except json.decoder.JSONDecodeError: - user_error(f"Invalid json") - - -def parse_args(): - parser = argparse.ArgumentParser( - prog="Markdown inline code checker", - description="Tool for checking the syntax, the format and the output of markdown inline code", - ) - parser.add_argument( - "path", - help="path of file or directory to check syntax on", - nargs="?", - default=".", - ) - parser.add_argument( - "--languages", - "-l", - nargs="+", - help="languages to check syntax of", - default=["cf3", "json", "yaml"], - required=False, - ) - parser.add_argument( - "--extract", - help="extract the inline code into their own files", - action="store_true", - required=False, - ) - parser.add_argument( - "--autoformat", - help="automatically format all inline code", - action="store_true", - required=False, - ) - parser.add_argument( - "--syntax-check", - help="check syntax of all inline code", - action="store_true", - required=False, - ) - parser.add_argument( - "--replace", - help="replace inline code", - action="store_true", - required=False, - ) - parser.add_argument( - "--output-check", - help="check output of all inline code", - action="store_true", - required=False, - ) - - return parser.parse_args() - - -if __name__ == "__main__": - supported_languages = {"cf3": "cf", "json": "json", "yaml": "yml"} - args = parse_args() - - if not os.path.exists(args.path): - user_error("This path doesn't exist") - - if ( - args.syntax_check - and "cf3" in args.languages - and not which("/var/cfengine/bin/cf-promises") - ): - user_error("cf-promises is not installed") - - for language in args.languages: - if language not in supported_languages: - user_error( - f"Unsupported language '{language}'. The supported languages are: {", ".join(supported_languages.keys())}" - ) - - parsed_markdowns = get_markdown_files(args.path, args.languages) - - for origin_path in parsed_markdowns["files"].keys(): - offset = 0 - for i, code_block in enumerate( - parsed_markdowns["files"][origin_path]["code-blocks"] - ): - - # adjust line numbers after replace - for cb in parsed_markdowns["files"][origin_path]["code-blocks"][i:]: - cb["first_line"] += offset - cb["last_line"] += offset - - language = supported_languages[code_block["language"]] - snippet_path = f"{origin_path}.snippet-{i+1}.{language}" - - if args.extract and "noextract" not in code_block["flags"]: - extract( - origin_path, - snippet_path, - language, - code_block["first_line"], - code_block["last_line"], - ) - - if args.syntax_check and "novalidate" not in code_block["flags"]: - check_syntax( - origin_path, - snippet_path, - language, - code_block["first_line"], - code_block["last_line"], - ) - - if args.autoformat and "noautoformat" not in code_block["flags"]: - autoformat( - origin_path, - snippet_path, - language, - code_block["first_line"], - code_block["last_line"], - ) - - if args.output_check and "noexecute" not in code_block["flags"]: - check_output() - - if args.replace and "noreplace" not in code_block["flags"]: - offset = replace( - origin_path, - snippet_path, - language, - code_block["first_line"], - code_block["last_line"], - )