Overwrite policies

Types of policies

For configs and patterns there exist two overwrite directive policies. They are:

  • Do not overwrite if directives from the configs are already defined in the Bacula resource configuration. Add only new ones.

  • Overwrite if directives from the configs are already defined in the Bacula resource configuration.

Overwriting coresponds both for simple directives with a simple scalar values (like string, integer, size, time or boolean values) and for complex values (like arrays or objects).

Policy: Do not overwrite

In case if the config and the Bacula resource have the same directives defined, this policy causes that the same directives will not be applied. Other directives that are different will be added to configuration. This do not overwrite policy is set by default.

Example for simple value

In the config we have the following directive:

Maximum Concurrent Jobs = 10

In Bacula configuration resource this directive already exists:

Maximum Concurrent Jobs = 25

In result, Maximum Concurrent Jobs directive will be untouched and it will stay value 25:

Maximum Concurrent Jobs = 25

Example for complex value

In the config we have the following directive:

Storage = "My new storage"

In Bacula configuration resource this directive already exists and has three values:

Storage = "Storage A"
Storage = "Storage B"
Storage = "Storage C"

The result will be the following:

Storage = "Storage A"
Storage = "Storage B"
Storage = "Storage C"
Storage = "My new storage"

Policy: Overwrite

In case if the config and the Bacula resource have the same directives defined, enabling this policy will cause that the same directives will be overwritten by values from the config. Other directives that are different in config and Bacula configuration will be added to the resource configuration.

Please note, if there is applied config with Name directive defined on single resource and the overwrite policy is enabled, this resource will be renamed to name that is in config. For applying this config to multiple resources, the first resource will be renamed and after the process will fail because there cannot be multiple the same type resources with the same name in the Bacula configuration.

Example for simple value

In the config we have the following directive:

Maximum Concurrent Jobs = 10

In Bacula configuration resource this directive already exists:

Maximum Concurrent Jobs = 25

In result, Maximum Concurrent Jobs directive will be overwritten and the value will be set to 10:

Maximum Concurrent Jobs = 10

Example for complex value

In the config we have the following directive:

Storage = "My new storage"

In Bacula configuration resource this directive already exists and has three values:

Storage = "Storage A"
Storage = "Storage B"
Storage = "Storage C"

The result will be the following:

Storage = "My new storage"

API config format

To better understand how the overwriting works, it can be useful to see in the Bacularis API panel how there look example resource configurations in the JSON format. For example:

{
   "Pool": {
     "Name": "Differential-VTL",
     "PoolType": "Backup",
     "ActionOnPurge": "Truncate",
     "MaximumVolumeJobs": 5,
     "VolumeRetention": 18144000,
     "VolumeUseDuration": 86400,
     "Storage": [
       "Storage A",
       "Storage B",
       "Storage C"
     ],
     "AutoPrune": true,
     "Recycle": true,
     "RecyclePool": "Scratch",
     "ScratchPool": "Scratch"
   }
 }

Here we can see that the three storage directives in Bacula configuration:

Storage = "Storage A"
Storage = "Storage B"
Storage = "Storage C"

in the JSON form are one complex value that is an array:

"Storage": [
  "Storage A",
  "Storage B",
  "Storage C"
]

Examples

Examples for applying config with overwrite policy enabled and disabled

Config directives

Bacula config

Result - overwrite disabled

Result - overwrite enabled

aaa = "config"
bbb = "bacula"
aaa = "config"
bbb = "bacula"
aaa = "config"
bbb = "bacula"
aaa = "config"
aaa = "bacula"
aaa = "bacula"
aaa = "config"
aaa = "config"
bbb = "config"
aaa = "bacula"
ccc = "bacula"
aaa = "bacula"
bbb = "config"
ccc = "bacula"
aaa = "config"
bbb = "config"
ccc = "bacula"
aaa = "config"
aaa = "bacula1"
aaa = "bacula2"
aaa = "bacula1"
aaa = "bacula2"
aaa = "config"
aaa = "config"