Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/set attributes cmd #11961

Merged
merged 18 commits into from
Jul 18, 2023
Merged

Conversation

gabrielmougard
Copy link
Contributor

closes #10960

@monstermunchkin
Copy link
Contributor

@gabrielmougard could you please add some tests?

lxc/cluster.go Outdated Show resolved Hide resolved
lxc/cluster.go Outdated Show resolved Hide resolved
lxc/network.go Outdated Show resolved Hide resolved
lxc/network_acl.go Outdated Show resolved Hide resolved
lxc/network_acl.go Outdated Show resolved Hide resolved
lxc/storage_bucket.go Outdated Show resolved Hide resolved
lxc/storage_volume.go Outdated Show resolved Hide resolved
lxc/storage_volume.go Outdated Show resolved Hide resolved
lxc/cluster.go Outdated Show resolved Hide resolved
lxc/cluster.go Outdated Show resolved Hide resolved
lxc/utils.go Outdated Show resolved Hide resolved
lxc/utils.go Outdated Show resolved Hide resolved
@ru-fu
Copy link
Contributor

ru-fu commented Jul 11, 2023

Should this be property instead of attribute?
https://documentation.ubuntu.com/lxd/en/latest/explanation/instance_config/

We only have it explicitly documented for instances, but in the docs, we're trying to be consistent in calling everything under config "options"/"configuration options" and everything on top level "properties".

@monstermunchkin
Copy link
Contributor

Should this be property instead of attribute? https://documentation.ubuntu.com/lxd/en/latest/explanation/instance_config/

Yes, we should call it property.

@ru-fu
Copy link
Contributor

ru-fu commented Jul 11, 2023

Thanks!
Can you add a "Configure instance properties" section to https://documentation.ubuntu.com/lxd/en/latest/howto/instances_configure/ and update https://documentation.ubuntu.com/lxd/en/latest/explanation/instance_config/ to link to that section for instance properties?

We should probably also update the other configuration how-tos, but we can do that later if needed.

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we have some tests added for this functionality too please.

lxc/utils.go Outdated Show resolved Hide resolved
@gabrielmougard
Copy link
Contributor Author

@tomponline I added two tests (for a string property and for a bool property) but only for an instance object. As the code is the same for all the other entities (network, network_acl, network forward, profile, etc.) should I add the same tests for each entity ?

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you use the normal i18n: Update translation templates message style (without typo ;) too) when updating i18n.

@tomponline
Copy link
Member

@ru-fu I expect that we should update the docs for this new CLI feature, do you have a preference as to where?

@tomponline
Copy link
Member

@ru-fu oh wait you already did in #11961 (comment), @gabrielmougard please can you add. thanks.

Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can you split your Go commits by file so its possible to backport the ones that are supported by the LTS.

lxc/utils.go Outdated Show resolved Hide resolved
lxc/utils.go Outdated Show resolved Hide resolved
@tomponline
Copy link
Member

@gabrielmougard looks like this needs a rebase now.

@gabrielmougard gabrielmougard force-pushed the fix/set-attributes-cmd branch 2 times, most recently from 76f91ef to eb8255f Compare July 14, 2023 15:55
@github-actions github-actions bot added the Documentation Documentation needs updating label Jul 14, 2023
@tomponline tomponline requested a review from ru-fu July 15, 2023 07:50
Copy link
Member

@tomponline tomponline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed lets add a test for setting/getting the instance snapshot and storage volume snapshot expiry times.

@tomponline
Copy link
Member

Needs a rebase

doc/explanation/instance_config.md Outdated Show resolved Hide resolved
doc/howto/instances_configure.md Show resolved Hide resolved
To update instance properties after the instance is created, use the `lxc config set` command with the `--property` flag.
Specify the instance name and the key and value of the instance property:

lxc config set <instance_name> <option_key>=<option_value> <option_key>=<option_value> ... --property
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if some of these properties are actually options?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the command will output an error saying that the <option_key> has not been found

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the command will output an error saying that the <option_key> has not been found

How much effort would it be to check if the key exists as an option, and in that case report that back to the user?

We're making a difference between properties and options in the docs, but we cannot necessarily expect users to be aware of the difference. And I could imagine users getting quite confused if we're telling them that one of the keys, which they have used before, suddenly can't be found anymore.

doc/howto/instances_configure.md Outdated Show resolved Hide resolved
doc/howto/instances_configure.md Outdated Show resolved Hide resolved
@gabrielmougard gabrielmougard force-pushed the fix/set-attributes-cmd branch 2 times, most recently from e646bcf to 32eb4ec Compare July 17, 2023 15:33
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
…rties

Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
test/suites/config.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@ru-fu ru-fu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs look good.

@tomponline
Copy link
Member

static analysis failing

test/suites/config.sh Outdated Show resolved Hide resolved
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>
@tomponline tomponline merged commit e5a365e into canonical:main Jul 18, 2023
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation needs updating
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to set attributes in set commands
4 participants