-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add support for smart
command - slightly different
#24
base: master
Are you sure you want to change the base?
Conversation
… health statistics. this feature can be enabled by a new config option called 'smart' allow for the stdout to be logged (so it is part of the report mail).
smart
command - slightly differentsmart
command - slightly different
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.
Thx for the PR. Some minor comments:
""" | ||
Run snapraid command | ||
Raises subprocess.CalledProcessError if errorlevel != 0 | ||
""" | ||
stdout_level = logging.INFO if log_output else logging.OUTPUT | ||
stderr_level = logging.ERROR if log_output else logging.OUTERR |
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 do you change the loglevel of stderr here?
@@ -45,11 +45,13 @@ def tee_thread(): | |||
return t | |||
|
|||
|
|||
def snapraid_command(command, args={}, *, allow_statuscodes=[]): | |||
def snapraid_command(command, args={}, *, allow_statuscodes=[], log_output = False): |
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.
IMO log_ouput
is not the right name for this. The output is always logged. It's just that if the user sets the email preference to short
, stdout is not included in the email. increase_output_loglevel
would be better. Also please follow pep8.
def snapraid_command(command, args={}, *, allow_statuscodes=[], log_output = False): | |
def snapraid_command(command, args={}, *, allow_statuscodes=[], | |
increase_output_loglevel=False): |
; prints a SMART report of all the disks of the array. | ||
smart = true |
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'd prefer for this to be false. Otherwise the script will fail per default if the user doesn't have smartctrl. Also a note Make sure smartctl is in your PATH.
in the comment would be helpful.
smart
command - slightly differentsmart
command - slightly different
Hi, I made this pull request without noticing there is already a similar one (#15 ). But it seems conflicted and inactive so I open mine anyway.