forked from Proxmox/proxmox
notify: include 'hostname' metadata field for forwarded mails
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
parent
f0bf95f53b
commit
870d9c2739
@ -231,6 +231,9 @@ impl Notification {
|
|||||||
let title = message.subject().unwrap_or_default().into();
|
let title = message.subject().unwrap_or_default().into();
|
||||||
let body = message.body_text(0).unwrap_or_default().into();
|
let body = message.body_text(0).unwrap_or_default().into();
|
||||||
|
|
||||||
|
let mut additional_fields = HashMap::new();
|
||||||
|
additional_fields.insert("hostname".into(), proxmox_sys::nodename().into());
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
// Unfortunately we cannot reasonably infer the severity from the
|
// Unfortunately we cannot reasonably infer the severity from the
|
||||||
// mail contents, so just set it to the highest for now so that
|
// mail contents, so just set it to the highest for now so that
|
||||||
@ -243,7 +246,7 @@ impl Notification {
|
|||||||
},
|
},
|
||||||
metadata: Metadata {
|
metadata: Metadata {
|
||||||
severity: Severity::Unknown,
|
severity: Severity::Unknown,
|
||||||
additional_fields: Default::default(),
|
additional_fields,
|
||||||
timestamp: proxmox_time::epoch_i64(),
|
timestamp: proxmox_time::epoch_i64(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -278,14 +281,21 @@ impl Config {
|
|||||||
if let Some(obj) = value.as_object_mut() {
|
if let Some(obj) = value.as_object_mut() {
|
||||||
obj.insert("origin".to_string(), Value::String("builtin".into()));
|
obj.insert("origin".to_string(), Value::String("builtin".into()));
|
||||||
} else {
|
} else {
|
||||||
log::error!("section config entry is not an object. This should not happen");
|
log::error!(
|
||||||
|
"section config entry is not an object. This should not happen"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Entry is built-in, but it has been modified by the user.
|
// Entry is built-in, but it has been modified by the user.
|
||||||
if let Some(obj) = value.as_object_mut() {
|
if let Some(obj) = value.as_object_mut() {
|
||||||
obj.insert("origin".to_string(), Value::String("modified-builtin".into()));
|
obj.insert(
|
||||||
|
"origin".to_string(),
|
||||||
|
Value::String("modified-builtin".into()),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
log::error!("section config entry is not an object. This should not happen");
|
log::error!(
|
||||||
|
"section config entry is not an object. This should not happen"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user