Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions server/src/main/java/com/cloud/alert/AlertManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,11 @@ public void sendAlert(AlertType alertType, long dataCenterId, Long podId, Long c
mailProps.setContent(content);
mailProps.setContentType("text/plain");

if (recipients == null) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @DaanHoogland @GutoVeronezi can you review this thanks.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind Daan already LGTM'd. Let's wait for the test.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could do this validation before instantiating the properties.

s_logger.info("No recipients set in 'alert.email.addresses', skipping sending an alert");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add subject and content to the message, e.g. ... skipping sending alert with subject [%s] and content [%s].
Also, IMHO, I think it would be better to log it as warning.

return;
Comment thread
Pearl1594 marked this conversation as resolved.
Outdated
}

Set<MailAddress> addresses = new HashSet<>();
for (String recipient : recipients) {
addresses.add(new MailAddress(recipient));
Expand Down