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

lxc remote switch should suggest completion of any locally configured remote #14635

Closed
simondeziel opened this issue Dec 10, 2024 · 4 comments · Fixed by canonical/lxd-pkg-snap#674
Assignees
Labels
Bug Confirmed to be a bug
Milestone

Comments

@simondeziel
Copy link
Member

simondeziel commented Dec 10, 2024

It seems that only builtin remote are proposed during tab-completion:

$ lxc remote switch <tab>
images                local                 ubuntu                ubuntu-daily          ubuntu-minimal        ubuntu-minimal-daily 

But I have many more remotes. Icing on the cake would be to remove the current one from the list of suggestion.

Additional information

$ snap list lxd
Name  Version      Rev    Tracking     Publisher   Notes
lxd   git-de3f147  31657  latest/edge  canonical✓  -
@markylaing
Copy link
Contributor

TIL that set-default is an alias for switch and not the other way around 😆

@kadinsayani
Copy link
Contributor

kadinsayani commented Dec 16, 2024

I'm seeing all of my remotes (including non-default remotes) appear when tab completing lxc remote switch on my end. For this completion, we load remotes from g.conf.Remotes, which should include all remotes. Do you have a reproducer I can try in order to continue investigating further?

@simondeziel
Copy link
Member Author

@kadinsayani if you've built snaps before, you should have craft-com.ubuntu.cloud-buildd and craft-com.ubuntu.cloud-buildd-daily remotes. Can you tab complete those when on latest/edge cause I cannot.

@kadinsayani
Copy link
Contributor

kadinsayani commented Dec 16, 2024

It looks like this issue is only prevalent with the LXD snap - upon regenerating the completion script and sourcing it locally, all remotes appear as expected.

A fresh install of the LXD snap yields the following results:

root@c1:~# lxd.lxc __complete remote switch cd
ubuntu
ubuntu-daily
ubuntu-minimal
ubuntu-minimal-daily
images
cdimage
local
:4
Completion ended with directive: ShellCompDirectiveNoFileComp
root@c1:~# lxd.lxc remote switch [TAB]
images                ubuntu                ubuntu-minimal
local                 ubuntu-daily          ubuntu-minimal-daily

The completion directive returns all of the available remotes, but it appears that snapd is intercepting the response and excluding non-default remotes (cdimage in this case).

@kadinsayani kadinsayani added Bug Confirmed to be a bug Improvement Improve to current situation labels Dec 17, 2024
@kadinsayani kadinsayani added this to the lxd-6.3 milestone Dec 17, 2024
@kadinsayani kadinsayani removed the Improvement Improve to current situation label Dec 17, 2024
tomponline added a commit that referenced this issue Dec 17, 2024
…pletions (#14677)

Resolves 1/2 issues raised in
#14635.

This PR adds logic to exclude the default (current) remote from shell
completions when running `lxc remote switch|remove`. As described in
[this
comment](#14635 (comment)),
it appears that `snapd` is intercepting the response and excluding
non-default remotes (`cdimage` in this case). I'll see if I can land a
fix for the second issue in https://github.com/canonical/lxd-pkg-snap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed to be a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants