-
Notifications
You must be signed in to change notification settings - Fork 12
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
WIP: Cleaning up the CLI mess stack #97
base: master
Are you sure you want to change the base?
WIP: Cleaning up the CLI mess stack #97
Conversation
5c9dbb0
to
076ce72
Compare
This is ready for a review, but should not yet be merged. |
"""Return the script name without .py extension if any. This assumes that the script name does not contain a | ||
dot in case of lacking an extension. | ||
""" | ||
(name, _) = os.path.splitext(full_name) |
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.
use pathlib
|
||
import os | ||
import warnings | ||
from functools import wraps |
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.
what does this do?
NAGIOS_CACHE_FILENAME_TEMPLATE % (_script_name(sys.argv[0]),) | ||
) | ||
), | ||
'nagios-check-interval-threshold': ('threshold of nagios checks timing out', 'int', 'store', 0), |
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.
I still don't know what this does, thresholds are configured in icinga, not in checks.
'nagios-report': ('print out nagios information', None, 'store_true', False, 'n'), | ||
'nagios-check-filename': | ||
('filename of where the nagios check data is stored', 'str', 'store', | ||
os.path.join( |
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.
use pathlib
Set the log level | ||
""" | ||
if self.options.quiet: | ||
logging.basicConfig(level=logging.WARNING) |
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.
I see a mixture of fancylogger and regular logging, most of the time that does not work (e.g. one or the other get's lost.) has this been tested?
Convenience method that exists with nagios unknown exitcode | ||
""" | ||
exit_from_errorcode(3, msg) | ||
# def ok(self, msg): |
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.
why are these in comment?
@@ -408,30 +753,32 @@ def main(self): | |||
self.fulloptions.epilogue(f"{msg} complete", self.thresholds) | |||
|
|||
|
|||
@deprecated_class("Base your scripts on the CLIBase class instead") | |||
class NrpeCLI(CLI): |
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.
why are these deprecated?
@itkovian as discussed, can we get an overview of what we are trying to achieve and the problems we are trying to solve? |
Move code to a new stack such that we can ditch a lot of obsolete code that was once introduced to deal with py 2.[47] shortcomings.
post
method