add: Deprecation warnings for old config values

This commit is contained in:
Arne Beer 2021-11-07 17:38:31 +01:00
parent 8699f07df1
commit 6b09e37eff
No known key found for this signature in database
GPG key ID: CC9408F679023B65
4 changed files with 22 additions and 2 deletions

2
Cargo.lock generated
View file

@ -1015,7 +1015,7 @@ dependencies = [
[[package]]
name = "pueue-lib"
version = "0.18.2-alpha.0"
source = "git+https://github.com/Nukesor/pueue-lib?branch=master#0be3c3a098f8a8c9276cade811704634a5597e3d"
source = "git+https://github.com/Nukesor/pueue-lib?branch=master#a67e749564f225c855273454fefbf8622c253770"
dependencies = [
"async-trait",
"byteorder",

View file

@ -49,6 +49,15 @@ async fn main() -> Result<()> {
// Try to read settings from the configuration file.
let (settings, config_found) = Settings::read_with_defaults(&opt.config)?;
#[allow(deprecated)]
if settings.daemon.groups.is_some() {
println!(
"Please delete the 'daemon.groups' section from your config file.\n\
It is no longer used and groups can now only be edited via the commandline interface.\n\n\
Attention: The first time the daemon is restarted this update, the amount of parallel tasks per group will be reset to 1!!"
)
}
// Error if no configuration file can be found, as this is an indicator, that the daemon hasn't
// been started yet.
if !config_found {

View file

@ -4,7 +4,7 @@ use std::{fs::create_dir_all, path::PathBuf};
use anyhow::{bail, Result};
use crossbeam_channel::{unbounded, Sender};
use log::warn;
use log::{error, warn};
use pueue_lib::network::certificate::create_certificates;
use pueue_lib::network::message::{Message, Shutdown};
@ -55,6 +55,15 @@ pub async fn run(config_path: Option<PathBuf>, test: bool) -> Result<()> {
}
};
#[allow(deprecated)]
if settings.daemon.groups.is_some() {
error!(
"Please delete the 'daemon.groups' section from your config file. \n\
It is no longer used and groups can now only be edited via the commandline interface. \n\n\
Attention: The first time the daemon is restarted this update, the amount of parallel tasks per group will be reset to 1!!"
)
}
init_directories(&settings.shared.pueue_directory());
if !settings.shared.daemon_key().exists() && !settings.shared.daemon_cert().exists() {
create_certificates(&settings.shared)?;

View file

@ -128,11 +128,13 @@ pub fn daemon_base_setup() -> Result<(Settings, TempDir)> {
status_datetime_format: "%Y-%m-%d\n%H:%M:%S".into(),
};
#[allow(deprecated)]
let daemon = Daemon {
pause_group_on_failure: false,
pause_all_on_failure: false,
callback: None,
callback_log_lines: 15,
groups: None,
};
let settings = Settings {