Skip to content

inspector completion: fix inaccessible db silent err#20

Open
bocekm wants to merge 1 commit into
oamg:mainfrom
bocekm:print-error-when-leapp-db-is-inaccessible
Open

inspector completion: fix inaccessible db silent err#20
bocekm wants to merge 1 commit into
oamg:mainfrom
bocekm:print-error-when-leapp-db-is-inaccessible

Conversation

@bocekm

@bocekm bocekm commented Jul 4, 2025

Copy link
Copy Markdown
Member

Before, running leapp-inspector --db ~/Downloads/leapp.db actors --actor and pressing Tab did not do anything. It was because the bash completion script exited silently when it concluded that the ~/Downloads/leapp.db is inaccessible.

With this fix one gets this error instead:

OSError: The ~/Downloads/leapp.db file doesn't exist. Specify
the correct path to the leapp database file.

With that the user gets a hint that they need to pass a path like /home/user/Downloads/leapp.db to get the completion working.

Assisted-by: Cursor AI with Claude Sonnet 4

Before, running `leapp-inspector --db ~/Downloads/leapp.db actors --actor` and
pressing Tab did not do anything. It was because the bash completion
script exited silently when it concluded that the ~/Downloads/leapp.db
is inaccessible.

With this fix one gets this error instead:
```
OSError: The ~/Downloads/leapp.db file doesn't exist. Specify
the correct path to the leapp database file.
```

With that the user gets a hint that they need to pass a path like
/home/user/Downloads/leapp.db to get the completion working.

Assisted-by: Cursor AI with Claude Sonnet 4
@bocekm bocekm requested a review from pirat89 July 4, 2025 19:53
for word in "${COMP_WORDS[@]}"; do
if [[ "$use_next" == "1" ]]; then
[[ -e "$word" ]] || return 1
# Check if file exists, but still return the path

@pirat89 pirat89 Sep 6, 2025

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

actually it means that function is behaving differently in comparison to the description and expactations. also you can see that script is failing on python error as it's failing on the leapp-inspector script execution. The clean solution would be just adding a log error instead.

Similarly in the other case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants