commandsio import

Import all, or part of, the servers configuration from a JSON or YAML file.

Usage

import [item …] root file.(json|yaml|yml) [update|replace] [confirm] [quiet] [timestamp] [name=value …] [‐‐ reference]

where
item one or more item types to import. If other item types are defined within the data file, they will be ignored. Default = calendars, jobs & properties.
acls import acls.
calendars import calendars.
configs import configs, if root is /.
hosts import host acls, if root is /.
jobs import jobs.
properties import properties.
protected import protected users and hosts, if root is /.
all import all the above item types, if root is /. Otherwise, import all the above items except hosts & protected.
root group whose contents to import. If the data file contains items that do not belong to this group, the import will fail.
file.(json|yaml|yml) to import.
update update existing items.
replace update existing items, and/or delete existing items in root that are not defined within the data file.
confirm do not prompt the user to confirm the changes.
quiet only output a summary of changes, rather than the details of every change.
timestamp print the run time of this command, even if timestamp is off.
name=value One of more variable definitions that can be inserted into job and property definitions as follows:
Name Action
job.user Unconditionally sets each job user to value.
job.host Unconditionally sets each job host to value.
name Where name matches a job property or group property name, the property will be set to value.
name Will be insterted into job user, host and descriptions.
Name/Value Result
id=1 Job host server-{{id}} becomes server-1
id=1
env=production
Job description Backup {{env}} server-{{id}} daily becomes Backup production server-1 daily
reference optional reference string. For example this could contain a reference number from a change management system.

write for calendar & job items, admin for acl items.

Examples

Import a data file

Import all /examples/webhooks calendars and jobs.

BeyondCron % import /examples/webhooks /…/example-webhooks.json

Creating: + /examples/webhooks/critical-mass (Job) + /examples/webhooks/private-property (Job)

Implement changes (Yes/No): Yes

Re-import a data file

Importing data file whose contents are identical to the current server configuration does nothing.

BeyondCron % import /examples/webhooks /…/example-webhooks.json

File /…/example-webhooks.json contains no changes.

Attempt to import a data file with a modified job

Unless the update or replace flag is given, import will fail if the data file modifies a current item.

BeyondCron % import /examples/webhooks /…/example-webhooks-2.json

Updating: ~ /examples/webhooks/critical-mass (Job)   Select 'update' or 'replace' to modify existing items.

Import a data file with a modified job

Import a data file without prompting for confirmation.

BeyondCron % import /examples/webhooks /…/example-webhooks-2.json update confirm

Updated: ~ /examples/webhooks/critical-mass (Job)

Import a data file with a renamed job

BeyondCron % import /examples/webhooks /…/example-webhooks-3.json update

Creating: + /examples/webhooks/hidden-property (Job)

Implement changes (Yes/No): Yes

Synchronise a group

Ensure that the configuration of a group matches a data file.

BeyondCron % import /examples/webhooks /…/example-webhooks-3.json replace

Deleting: - /examples/webhooks/private-property (Job)

Implement changes (Yes/No): Yes

Attempt to import into an incorrect group

Attempting to import data into the incorrect group will abort the import.

BeyondCron % import /examples/triggers /…/example-webhooks-3.json replace

Import of /Users/adr/tmp/example-webhooks-3.json failed.   Out of scope (/examples/triggers): - /examples/webhooks/critical-mass (Job) - /examples/webhooks/hidden-property (Job)

See also