pmarini
(Pietro Marini)
September 20, 2022, 9:14pm
1
Hello,
Seems I’m failing to find a solution to a simple issue.
I’d like to pass the description in the initial creation of an object (container, storage, project) or to set it later with set but don’t know how to do it.
The only way I know as of now is to edit the configuration with lxc config edit or similar, that doesn’t really get along with scripting and automation.
Thanks
turtle0x1
(Turtle0x1)
September 20, 2022, 10:47pm
2
If you want to use the “description” key looks like you might have to use the method described here;
If anyone needs it, this is a way to do it.
echo "Setting image versions"
export VERSION="$(date +"%m/%d/%Y %I:%M%p")"
envsubst '${VERSION}' < build/django-image-info.yaml > temp-version.yaml
cat temp-version.yaml | lxc image edit django-server
you can get the image-info.yaml from the image.
Or you could use user.comment(I think a well used sub-key) to set it pragmatically without exporting, editing, and reimporting the YAML.
Might be a more modern way but doesn’t look like it at first glance
pmarini
(Pietro Marini)
September 21, 2022, 7:46am
3
Thanks for the feedback @turtle0x1 .
Didn0’t know aboyt user.commet, it could be an option, but it is not visible in a list statement.
What I’m looking for is something like
lxc <object> set description "My Nice Object"
That would generally work for all the objects: storages, networks, projects, profiles, containers…
Maybe an enhancement to be considered?
tomp
(Thomas Parrott)
September 26, 2022, 11:40am
4
You could also use the API directly.
pmarini
(Pietro Marini)
September 26, 2022, 1:16pm
5
Thanks!
Is it possible to use the command line as well?
tomp
(Thomas Parrott)
September 26, 2022, 2:10pm
6
turtle0x1
(Turtle0x1)
September 26, 2022, 2:15pm
7
I think its missing
lxc config set c1 description "wow"
Error: Invalid config: Unknown configuration key: description
tomp
(Thomas Parrott)
September 26, 2022, 2:16pm
8
Or right yes, silly me. You can only do it using the API or via lxc {object} edit
pmarini
(Pietro Marini)
September 27, 2022, 7:20pm
9
1 Like