use handlebars::{Handlebars, Helper, Context, RenderError, RenderContext, Output, HelperResult, TemplateError};
-use proxmox::tools::email::sendmail;
-use proxmox::api::schema::parse_property_string;
-use proxmox::try_block;
-
-use crate::{
- config::datastore::DataStoreConfig,
- config::verify::VerificationJobConfig,
- config::sync::SyncJobConfig,
- config::tape_job::TapeBackupJobSetup,
- api2::types::{
- APTUpdateInfo,
- GarbageCollectionStatus,
- Userid,
- Notify,
- DatastoreNotify,
- },
- tools::format::HumanByte,
+use proxmox_sys::email::sendmail;
+use proxmox_lang::try_block;
+use proxmox_schema::ApiType;
+
+use pbs_api_types::{
+ User, TapeBackupJobSetup, SyncJobConfig, VerificationJobConfig,
+ APTUpdateInfo, GarbageCollectionStatus, HumanByte,
+ Userid, Notify, DatastoreNotify, DataStoreConfig,
};
const GC_OK_TEMPLATE: &str = r###"
Tape Pool: {{job.pool}}
Tape Drive: {{job.drive}}
+{{#if snapshot-list ~}}
+Snapshots included:
+{{#each snapshot-list~}}
+{{this}}
+{{/each~}}
+{{/if}}
Tape Backup failed: {{error}}
// so we include html as well
let html = format!("<html><body><pre>\n{}\n<pre>", handlebars::html_escape(text));
- let nodename = proxmox::tools::nodename();
+ let nodename = proxmox_sys::nodename();
let author = format!("Proxmox Backup Server - {}", nodename);
sendmail(
&[email],
- &subject,
- Some(&text),
+ subject,
+ Some(text),
Some(&html),
None,
Some(&author),
) -> Result<(), Error> {
let (fqdn, port) = get_server_url();
- let duration: crate::tools::systemd::time::TimeSpan = summary.duration.into();
+ let duration: proxmox_time::TimeSpan = summary.duration.into();
let mut data = json!({
"job": job,
"fqdn": fqdn,
// user will surely request that they can change this
- let nodename = proxmox::tools::nodename();
+ let nodename = proxmox_sys::nodename();
let mut fqdn = nodename.to_owned();
if let Ok(resolv_conf) = crate::api2::node::dns::read_etc_resolv_conf() {
) -> Result<(), Error> {
// update mails always go to the root@pam configured email..
if let Some(email) = lookup_user_email(Userid::root_userid()) {
- let nodename = proxmox::tools::nodename();
+ let nodename = proxmox_sys::nodename();
let subject = format!("New software packages available ({})", nodename);
let (fqdn, port) = get_server_url();
/// Lookup users email address
pub fn lookup_user_email(userid: &Userid) -> Option<String> {
- use crate::config::user::{self, User};
-
- if let Ok(user_config) = user::cached_config() {
+ if let Ok(user_config) = pbs_config::user::cached_config() {
if let Ok(user) = user_config.lookup::<User>("user", userid.as_str()) {
return user.email;
}
let notify = DatastoreNotify { gc: None, verify: None, sync: None };
- let (config, _digest) = match crate::config::datastore::config() {
+ let (config, _digest) = match pbs_config::datastore::config() {
Ok(result) => result,
Err(_) => return (email, notify),
};
let notify_str = config.notify.unwrap_or_default();
- if let Ok(value) = parse_property_string(¬ify_str, &DatastoreNotify::API_SCHEMA) {
+ if let Ok(value) = DatastoreNotify::API_SCHEMA.parse_property_string(¬ify_str) {
if let Ok(notify) = serde_json::from_value(value) {
return (email, notify);
}