onyo set
Set KEYs to VALUEs for assets.
KEY names can be any valid YAML key-name. If a key is not present in an asset, it is added and set appropriately.
In addition to keys in asset contents, some PSEUDO-KEYS can be set:
onyo.is.directory: boolean to control whether the asset is an Asset Directory.
The contents of all modified assets are checked for validity before committing. If problems are found, Onyo will error and leave the assets unmodified.
usage: onyo set [-h] -k KEY [KEY ...] -a ASSET [ASSET ...] [-m MESSAGE]
[--no-auto-message]
Named Arguments
- -k, --keys
KEY-VALUE pairs to set in assets. Multiple pairs can be given (e.g.
key1=value1 key2=value2 key3=value3).Quotes are necessary when using spaces or shell command characters:
` $ onyo set --keys title='Bob Bozniffiq: Saint of the Awkward' --asset ... `Dictionary subkeys can be addressed using a period (e.g.
model.name,model.year, etc.)- -a, --asset
Assets to set KEY-VALUEs in.
- -m, --message
Append MESSAGE to the commit message. If multiple
--messageoptions are given, their values are concatenated as separate paragraphs.- --no-auto-message
Do not auto-generate the commit message subject. If no MESSAGE is given, the subject line will be
[Empty subject]. This does not disable the inventory operations record at the end of a commit message. The default is configured via ‘onyo.commit.auto-message’.Default:
False
Examples
Upgrade an asset:
$ onyo set --keys RAM=16GB --asset accounting/Bingo\ Bob/laptop_lenovo_T490s.abc123
Change a key used in the asset name (thus renaming it):
$ onyo set --keys type=notebook --asset accounting/Bingo\ Bob/laptop_lenovo_T490s.abc123
Change the model name of all “mbp” to “macbookpro”:
$ onyo get --machine-readable --match model=macbookpro --keys path \
| xargs -d "\n" onyo --yes set --keys model=mbp --asset
Change an Asset File to an Asset Directory:
$ onyo set --keys onyo.is.directory=true --asset accounting/Bingo\ Bob/laptop_lenovo_T490s.abc123