Skip to content

Commit

Permalink
Merge pull request #2700 from nickanderson/ENT-10481/master
Browse files Browse the repository at this point in the history
ENT-10481: Added ability to enable backup archives during policy update
  • Loading branch information
nickanderson authored Aug 22, 2023
2 parents fef01b4 + 45a9fab commit c394415
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
44 changes: 43 additions & 1 deletion MPF.md
Original file line number Diff line number Diff line change
Expand Up @@ -1720,7 +1720,49 @@ For example:
}
```

**History**: Added in 3.10.1
**Notes:**

- This applies to `promises.cf`.


**History:**

- Introduced in CFEngine 3.10.1

### Configure default repository for file backups during policy update

By default the agent creates a backup of a file before it is edited in the same
directory as the edited file. This happens during policy update but the backup
files are culled by default as part of the default sync behavior.

Defining the `default:mpf_update_control_agent_default_repository` class will
cause these backups to be placed in `$(sys.workdir)/backups`. Customize the
backup directory by setting `default:update_def.control_agent_default_backup`.

For example:

```
{
"classes": {
"default:mpf_update_control_agent_default_repository": {
"class_expressions": [ "any::" ]
}
},
"variables": {
"default:update_def.control_agent_default_repository": {
"value": "/var/cfengine/policy-update-backups"
}
}
}
```

**Notes:**

- This applies to `update.cf`.

**History:**

- Introduced in CFEngine 3.23.0

### Configure periodic package inventory refresh interval

Expand Down
9 changes: 9 additions & 0 deletions controls/update_def.cf.in
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ bundle common update_def
# enable_cfengine_enterprise_hub_ha is defined below
# Disabled by default

# If we want to use the backup repository for update (because the class is
# defined) and if the location is not already configured (via Augments),
# set a default.

"control_agent_default_repository" -> { "ENT-10481" }
string => "$(sys.workdir)/backups",
if => and( "mpf_update_control_agent_default_repository",
not( isvariable( "control_agent_default_repository" ) ) );

enable_cfengine_enterprise_hub_ha::
"standby_servers" slist => filter("$(sys.policy_hub)", "ha_def.ips", false, true, 10);
"policy_servers" slist => { "$(sys.policy_hub)", "@(standby_servers)" };
Expand Down
6 changes: 6 additions & 0 deletions update.cf
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@ body agent control

agentfacility => "$(default:update_def.control_agent_agentfacility)";

mpf_update_control_agent_default_repository::

# Location to backup files before they are edited by cfengine

default_repository => "$(update_def.control_agent_default_repository)";

}

#############################################################################
Expand Down

0 comments on commit c394415

Please sign in to comment.