.config
Onesimus extension
Read, create, change, delete configuration resources as raw text (Onesimus).
Synopsis
.config capabilities [json]
.config list [json] type=<type>
.config read [json] type=<type> name=<name>
.config create [json] type=<type> text64=<text64> [validate_only]
.config update [json] type=<type> name=<name> sha256=<sha256> text64=<text64>
[validate_only]
.config delete [json] type=<type> name=<name> sha256=<sha256> [validate_only]
Words without brackets are required, [ ] marks optional parts, a | b alternatives, ... a repeatable argument and [,...] a comma separated list.
Description
Reads, creates, changes and deletes configuration resources as raw text (the same logic as the DirectorApi configuration RPCs). Changes need the CommandACL configure and the SHA-256 of the text read.
Arguments
| Argument | Type | Values / source | Default | Flags | Description |
|---|---|---|---|---|---|
json | keyword | Print the JSON object as text. |
These arguments apply to every subcommand as well.
Subcommands
.config capabilities
Editable types and operations.
Shows the interface version and, per resource type, the operations the configuration CRUD offers (READ_RAW, CREATE_RAW, UPDATE_RAW, DELETE). The editable types are schedule, job, jobdefs and client. Without the CommandACL configure no types are listed.
.config capabilities [json]
Also accepts the arguments of .config: json.
The editable types and their operations:
.config capabilities
.config list
Resources of a type.
Lists the resources of one type (schedule, job, jobdefs or client) with their file, SHA-256 and whether the file holds more than one resource. Resources the console may not see by its resource ACL are left out.
.config list [json] type=<type>
| Argument | Type | Values / source | Default | Flags | Description |
|---|---|---|---|---|---|
type= | enum | client, job, jobdefs, schedule, fileset | required | Resource type. |
Also accepts the arguments of .config: json.
All client resources with file and checksum:
.config list type=client
.config read
Raw text of a resource.
Returns the raw text of one resource byte for byte, with its file and SHA-256. The checksum is the optimistic lock for a later update or delete. A resource the console may not see gives the status DENIED.
.config read [json] type=<type> name=<name>
| Argument | Type | Values / source | Default | Flags | Description |
|---|---|---|---|---|---|
type= | enum | client, job, jobdefs, schedule, fileset | required | Resource type. | |
name= | string | required | Resource name. |
Also accepts the arguments of .config: json.
The raw client text and its checksum:
.config read type=client name=bareos-fd
.config create
New resource from text.
Creates a resource from its raw text, given base64 encoded in text64= because a console line carries no line ends. The new configuration is checked like odir -t, written atomically and reloaded, with rollback if the reload fails. With validate_only the text is only checked, nothing is written.
A result status other than OK (EXISTS, INVALID, DENIED …) is reported in the response, not as a command error. Needs the CommandACL configure.
.config create [json] type=<type> text64=<text64> [validate_only]
| Argument | Type | Values / source | Default | Flags | Description |
|---|---|---|---|---|---|
type= | enum | client, job, jobdefs, schedule, fileset | required | Resource type. | |
text64= | string | required | Resource text, base64. | ||
validate_only | keyword | Check only, write nothing. |
Also accepts the arguments of .config: json.
Check a new schedule without writing it:
.config create type=schedule text64=U2NoZWR1bGUgewogIE5hbWUgPSBOaWdodGx5CiAgUnVuID0gRnVsbCBzdW4gYXQgMjM6MDAKfQo validate_only
.config update
Replace a resource.
Replaces the raw text of a resource. sha256= must be the checksum from the last read; if the file changed since, the status is CONFLICT and nothing is written. The text is checked like odir -t, written atomically and reloaded with rollback; validate_only only checks. Needs the CommandACL configure.
.config update [json] type=<type> name=<name> sha256=<sha256> text64=<text64>
[validate_only]
| Argument | Type | Values / source | Default | Flags | Description |
|---|---|---|---|---|---|
type= | enum | client, job, jobdefs, schedule, fileset | required | Resource type. | |
name= | string | required | Resource name. | ||
sha256= | string | required | SHA-256 of the text read. | ||
text64= | string | required | Resource text, base64. | ||
validate_only | keyword | Check only, write nothing. |
Also accepts the arguments of .config: json.
Replace a schedule with new text:
.config update type=schedule name=Nightly sha256=5b1e9a3c text64=U2NoZWR1bGUgewogIE5hbWUgPSBOaWdodGx5CiAgUnVuID0gRnVsbCBzYXQgYXQgMjI6MDAKfQo
.config delete
Delete a resource.
Deletes a resource, guarded by the checksum from the last read. If other resources still refer to it the status is REFERENCED, the referring resources are listed and nothing is deleted. validate_only only checks. Needs the CommandACL configure.
.config delete [json] type=<type> name=<name> sha256=<sha256> [validate_only]
| Argument | Type | Values / source | Default | Flags | Description |
|---|---|---|---|---|---|
type= | enum | client, job, jobdefs, schedule, fileset | required | Resource type. | |
name= | string | required | Resource name. | ||
sha256= | string | required | SHA-256 of the text read. | ||
validate_only | keyword | Check only, write nothing. |
Also accepts the arguments of .config: json.
Check whether a client could be deleted:
.config delete type=client name=old-fd sha256=5b1e9a3c validate_only
Examples
The job resources as one JSON line:
.config list type=job json
The raw text of a schedule with its checksum:
.config read type=schedule name=WeeklyCycle