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

Incorrect auto-completion suggestions when non-default project is selected #14690

Closed
MusicDin opened this issue Dec 18, 2024 · 2 comments
Closed
Assignees
Labels
Bug Confirmed to be a bug Jira Triggers the synchronization of a GitHub issue in Jira
Milestone

Comments

@MusicDin
Copy link
Member

Issue description

It seems that auto-completion suggests resources from default project when different project is selected and --project flag is not used.

Steps to reproduce

$ lxc project create test
$ lxc init images:alpine/edge c1 -s default
$ lxc init images:alpine/edge c2 -s default --project test
$ lxc delete [TAB]
c1

$ lxc delete --project test [TAB]
c2

$ lxc project switch test        # Switch to a different project.
$ lxc delete --project default [TAB]
c1

$ lxc delete --project test [TAB]
c2

$ lxc delete [TAB]               # Project not explicitly specified.
c1                               # <-- This is wrong (c1 is in default project)

$ lxc delete c1
Error: Failed checking instance exists "local:c1": Failed to fetch instance "c1" in project "test": Instance not found
@MusicDin MusicDin added the Bug Confirmed to be a bug label Dec 18, 2024
@kadinsayani kadinsayani self-assigned this Dec 18, 2024
@kadinsayani kadinsayani added this to the lxd-6.3 milestone Dec 18, 2024
@kadinsayani kadinsayani added the Jira Triggers the synchronization of a GitHub issue in Jira label Dec 18, 2024
@kadinsayani
Copy link
Contributor

kadinsayani commented Dec 18, 2024

This is another issue only found in the LXD snap, similar to #14635 (comment).

root@c1:~# lxc __complete delete c
c2
:6
Completion ended with directive: ShellCompDirectiveNoSpace, ShellCompDirectiveNoFileComp
root@c1:~# lxc delete [TAB]
c1

Regenerating the completion script and sourcing it should fix this issue for now, see https://documentation.ubuntu.com/lxd/en/latest/installing/#shell-completions.

I'll continue investigating a potential solution for the LXD snap completion issues :)

cc. @simondeziel

tomponline added a commit to canonical/lxd-pkg-snap that referenced this issue Jan 7, 2025
Fixes canonical/lxd#14635,
canonical/lxd#14690 and
canonical/lxd#14648.

This PR changes the permissions, location, and file extension of the
`lxc` bash completions script to ensure correct execution. The
`bash-completions` package is also added to the snap stage packages.
@kadinsayani
Copy link
Contributor

Closed by canonical/lxd-pkg-snap#674.

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 Jira Triggers the synchronization of a GitHub issue in Jira
Projects
None yet
Development

No branches or pull requests

2 participants