Newer
Older
* Copyright (c) 2021-2022, Luca Fulchir <luker@fenrirproject.org>
*
* This file is part of dfim.
*
* dfim is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* dfim is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with dfim. If not, see <https://www.gnu.org/licenses/>.
*/
#[derive(::serde::Deserialize, ::serde::Serialize, Clone)]
#[serde(deny_unknown_fields)]
pub struct Exec {
pub id: String,
pub path: ::std::path::PathBuf,
fn id(&self) -> &str {
self.id.as_str()
}
fn targets(&self) -> Vec<String> {
Vec::new()
}
}
impl crate::config::CfgVerify for Exec {
fn standardize(&mut self) {}
fn check_consistency(
&self,
logger: &slog::Logger,
) -> Result<(), crate::config::errors::ConfigError> {
if !self.path.is_file() {
::slog::error!(logger, "Exec: no such file \"{:?}\"", self.path);
return Err(crate::config::errors::ConfigError::Consistency(
"No such file".to_owned(),
));
}
Ok(())
}
}