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

Error message with CLI command and "Working outside of application context" #4764

Open
Lounifitz opened this issue Jan 19, 2024 · 2 comments

Comments

@Lounifitz
Copy link

Lounifitz commented Jan 19, 2024

Good morning,
We have just performed the merge between your version 1.6.0 and our custom version 1.1.16 based on version 1.1.0 dating back 2 years.
We were also able to see the issues presented below on version 1.6.0 before the merge.
Ubuntu 20.04, Python 3.8, Postgres 12

First problem:
When we call the "lemur --help" or "lemur" or "lemur somethingwrong" command we get the following error message:

image

I modified line 67 of the factory.py file as follows, which seems to fix the problem. Is this normal?

image

Second problem:
Although we have respected your way of declaring our functions within our plugins and yours in the "cli.py" files, we obtain the following error when executing the "lemur command" command: "RuntimeError: Working outside of application context".
For this to work I had to add an import of "with_appcontext" and add the line "@with_appcontext" before the "cli" function definition.

image

Third problem:
Additionally, it seems that some cli functions are not correctly declared to be used such as the certificate rotate function which does not appear when calling help. Isn't the call to "@cli.command()" missing for certain cli functions?

image

Best regards

Marc

@ilyakruchinin
Copy link

I'm having the exact same issue, Ubuntu 22.04

@andreisolo0
Copy link

The same issue on Ubuntu 22.04 when trying to run lemur source sync, adding
from flask.cli import with_appcontext
@with_appcontext

in lemur/sources/cli.py solved the issue

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

No branches or pull requests

3 participants