bc-cliio 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]

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.
acls include acls.
calendars include calendars.
hosts include host acls.
jobs include jobs.
protected include protected users and hosts.
all include all the above item types.
root group whose contents to import. If the data file contains items that do not belong to this group, the import will fail. When importing hosts, protected or all, root must be /.
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.

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