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
mgr/dashboard v2: implement can_run method #20728
Conversation
6d28aed
to
756c759
Compare
@@ -74,6 +79,20 @@ def __init__(self, *args, **kwargs): | |||
mgr.init(self) | |||
self._url_prefix = '' | |||
|
|||
def can_run(self): | |||
if cherrypy is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we also need "bcrypt" package for the authentication to work, can we also add that check to this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
@jcsp regarding the |
@rjfd the awkward thing about checking for bcrypt is that it's not directly used in module.py, so we'd need a more general approach where we're catching the ImportError from the other modules too -- it could be interesting to do that by separating the web server into a separate .py so that we could readily catch all import errors while importing that from module.py, but that's probably for another day |
@jcsp I agree with you, importing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@@ -74,6 +79,20 @@ def __init__(self, *args, **kwargs): | |||
mgr.init(self) | |||
self._url_prefix = '' | |||
|
|||
def can_run(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the can_run
method in ../mgr_module.py
is declared as a static method. As it is declared here breaks the module loading. Please make this a static method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Updated. Had to un-property-ize the frontend_path method to get it usable from here too.
Should be especially handy in development environments for giving a clear message for people who have forgotten to build frontend bits. Signed-off-by: John Spray <john.spray@redhat.com>
756c759
to
b4190be
Compare
mgr/dashboard v2: implement can_run method Reviewed-by: Ricardo Dias <rdias@suse.com> Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com> (cherry picked from commit 5dfdecc) Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
This is just to give us friendlier behaviour if anything the dashboard expects is missing.