-
Notifications
You must be signed in to change notification settings - Fork 17
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
Send email notification when lease starts or ends soon #150
Conversation
You should update your commit message and the PR description to include a link to the issue with which it is associated. This will update the issue to include a link to the commit (for mention in the commit message) and to this PR (for the mention in the PR description). It's generally good practice for your commit message to provide some context for the changes. If you write something like:
Then the referenced issue will be closed automatically when this PR merges. If the PR and the issue are in the same repository, you can write:
|
c79a5e5
to
c9f28cc
Compare
Thank you for your advice! I've updated PR description as well as commit message with a link to the issue. |
@DanNiESh this looks pretty good - I think optimally we don't run openstack commands on the command line, but I think that can be updated later once the ESI commands get an SDK. Can you add some comments to the top of the file explaining how to run the script? |
c9f28cc
to
22d4f84
Compare
Done! |
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.
Just a few minor text changes!
bin/query_events.py
Outdated
email_body_lease_expire = f"Hi {lease['Project']}," \ | ||
f"\n\n" \ | ||
f"We would like to inform you that" \ | ||
f" your lease: {lease['UUID']} " \ |
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.
Can we add the node UUID and name as well?
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.
esi lease lease
command doesn't have an output of node uuid. Do we want to make another call to retrieve node uuid?
22d4f84
to
22d3779
Compare
I've updated the content of email body and provided external email templates for the script. |
I would expect this script to live in the The default template files should live in the package directory as well (e.g., in
You could also generate the path like this:
Rather than hardcoding the package name, you could ask for (You will still want to support using alternate templates using the |
053442c
to
b1b5668
Compare
updated the endpoint name to esi-leap-email-notification |
esi_leap/send_email_notification.py
Outdated
- LEASE_EXPIRE_TEMPLATE: Path to the email template for lease expiration | ||
warnings. Default is esi_leap/templates/lease_expire_email.txt | ||
|
||
After esi-leap package is installed, run `esi_leap_query_events` |
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.
Would you run esi-leap-email-notification
instead? I might mention that the script would be run periodically as well.
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 script itself doesn't have scheduling mechanism. But we can make it a cronjob to run periodically. Just add the command esi-leap-email-notification
in a crontab file and specify a frequency would work.
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.
Yep, sorry, I was unclear - the documentation should be updated to say "run esi-leap-email-notification" instead of "esi_leap_query_events", right? And I think the documentation should tell the operator to set up a periodic cron job rather than just running it once.
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.
Makes sense! I just added this instruction in the documentation.
b1b5668
to
224f8b0
Compare
224f8b0
to
fd50936
Compare
Looks good - thanks! |
Closes: #149