-
Notifications
You must be signed in to change notification settings - Fork 11
kernel: Create tool to check for new LTS kernel releases #253
Conversation
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.
Thanks - This is going to be very useful! A few comments...
@@ -0,0 +1,101 @@ | |||
#!/usr/bin/env python3 | |||
# | |||
# Copyright (c) 2017 Intel Corporation |
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.
2018?
email_recipients="root@localhost" | ||
|
||
def get_current_lts(): | ||
lts_file=script_path + "/current_lts_kernel" |
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 be tempted to put the current LTS version in ../versions.txt
so that all versions are kept in one place.
logging.info("current_lts_kernel file updated!") | ||
|
||
def send_email(new_lts): | ||
email_body="A new LTS version of the Linux kernel is out: " + new_lts |
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 include the current LTS kernel version too as that will allow us to have an extra "visual check" (hopefully we'll notice the "impossible scenario" where current == new
for example).
scripts/README.md
Outdated
Requirements: | ||
|
||
* python3 | ||
* python dependencies (see requirements file) |
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.
Could you add a link to this file?
scripts/README.md
Outdated
|
||
## `kernel_monitor/kernel_monitor.py` | ||
|
||
This script fetch the latest kernel information and look for new LTS releases. |
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.
This script fetches the latest kernel information and looks for new LTS releases.
scripts/README.md
Outdated
## `kernel_monitor/kernel_monitor.py` | ||
|
||
This script fetch the latest kernel information and look for new LTS releases. | ||
If a new LTS release is found, this script is able to send email to the selected |
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 make this even simpler. Something like,
If it finds a new LTS release it sends an email to the selected recipients.
scripts/README.md
Outdated
$ pip install -r requirements | ||
``` | ||
|
||
Set distro_certs variable to /etc/ssl/certs/ca-bundle.crt: |
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.
Could you add backticks around that path: /etc/ssl/certs/ca-bundle.crt
.
# email config | ||
smtp_hostname='127.0.0.1' | ||
email_sender="[email protected]" | ||
email_recipients="root@localhost" |
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.
How about making these command-line options?
distro_certs = "/etc/ssl/certs/ca-bundle.crt" | ||
|
||
# Log file path | ||
logfile="./example.log" |
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.
This could be a command-line option. Also, I'd change the default to something like kernel_monitor.log
.
@klynnrif - could you take a look at the doc changes please? |
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've suggested a few changes, and agree with the rewrites @jodh-intel made on lines 47 and 48. Thanks!
scripts/README.md
Outdated
|
||
Usage: | ||
|
||
NOTE: Supposing we have a Fedora 27 system with all requirements met and a postfix |
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.
Lines 60-61 suggested rewrite: NOTE: The following commands can be executed if you have a Fedora 27 system that meets all requirements, and a postfix server running on 127.0.0.1 or localhost.
scripts/README.md
Outdated
|
||
Set distro_certs variable to /etc/ssl/certs/ca-bundle.crt: | ||
|
||
NOTE: This path may change based on the Linux distribution you are using (see kernel_monitor.py). |
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.
NOTE: This path might change based on...
scripts/README.md
Outdated
sed -i "s/distro_certs = .*/distro_certs = \"\/etc\/ssl\/certs\/ca-bundle.crt\"/" kernel_monitor.py | ||
``` | ||
|
||
Execute the script: |
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.
Execute the following script:
scripts/README.md
Outdated
$ ./kernel_monitor.py | ||
``` | ||
|
||
This will send an email to `root@localhost` if there is a new LTS release and log |
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.
This sends an email to...
@jodh-intel @klynnrif Thank you! I've addressed your comments. |
scripts/README.md
Outdated
For more information about the complete usage: | ||
``` | ||
$ ./kernel_monitor.py --help | ||
Linux Kernel LTS monitor script. |
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 would recommend removing the output of this command here - one day, the options will change and we'll forget to update the doc as well as the usage statement in the script itself.
scripts/README.md
Outdated
|
||
NOTE: This path might change based on the Linux distribution you are using (see kernel_monitor.py). | ||
``` | ||
sed -i "s/distro_certs = .*/distro_certs = \"\/etc\/ssl\/certs\/ca-bundle.crt\"/" kernel_monitor.py |
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.
Couple of points:
- This line would need a
$
prompt. - I'm really not sure we want users to modify the script itself. Could you add an option for specifying the path to the certs file to avoid this?
scripts/README.md
Outdated
$ ./kernel_monitor.py | ||
``` | ||
|
||
This sends an email to `root@localhost` if there is a new LTS release and log |
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 remove root@localhost
and the logfile name here (which I think is now incorrect?) and explain that running, ./kernel_monitor.py --help
will show where the emails will be sent and which logfile will be used.
# by the distro of your choice. This is needed to retrieve the xml file. | ||
# Fedora => /etc/ssl/certs/ca-bundle.crt | ||
# Ubuntu => /etc/ssl/certs/ca-certificates.crt | ||
distro_certs = "/etc/ssl/certs/ca-bundle.crt" |
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.
- This won't work for Clear Linux.
- I think we need a CLI option to specify this path (or have it auto-detected based on distro?)
Hey @jodh-intel, I've now added a distro-certificates discovery functionality (good idea!). It works on Clear Linux as well 😄 |
Hi @erick0z - nice. For total paranoia, it would probably be safer to only check known locations for each distro (and ensure the file is owned by lgtm @klynnrif - could you re-review please? |
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.
One small change suggested unless it changes the meaning. Thanks!
scripts/README.md
Outdated
$ ./kernel_monitor.py | ||
``` | ||
|
||
This sends an email if there is a new LTS release and log the events to a file. |
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.
.....is a new LTS release and logs the events to a file.
We need to be notified when new LTS kernel releases are available to ensure we update the guest kernel in a timely fashion. This commit adds a documentation and a script which can check the latest kernel info and notify via email if a new LTS version is released. Fixes #246 Signed-off-by: Erick Cardona <[email protected]>
thanks! @klynnrif |
We need to be notified when new LTS kernel releases are available to ensure we
update the guest kernel in a timely fashion.
This commit adds documentation and a script which can check the latest kernel info
and notify via email if a new LTS version is released.
Fixes #246
Signed-off-by: Erick Cardona [email protected]