|
|
|
@ -11,8 +11,6 @@ pub struct Unit {
|
|
|
|
|
name: String,
|
|
|
|
|
state: UnitState,
|
|
|
|
|
description: String,
|
|
|
|
|
|
|
|
|
|
// Space only
|
|
|
|
|
documentation: Vec<String>,
|
|
|
|
|
|
|
|
|
|
// Space -and- list
|
|
|
|
@ -39,7 +37,6 @@ pub struct Unit {
|
|
|
|
|
requires_mounts_for: Vec<String>,
|
|
|
|
|
|
|
|
|
|
on_failure_job_mode: JobMode,
|
|
|
|
|
|
|
|
|
|
ignore_on_isolate: bool,
|
|
|
|
|
stop_when_unneeded: bool,
|
|
|
|
|
refuse_manual_start: bool,
|
|
|
|
@ -51,11 +48,11 @@ pub struct Unit {
|
|
|
|
|
success_action: UnitAction,
|
|
|
|
|
failure_action_exit_status: Option<u8>,
|
|
|
|
|
success_action_exit_status: Option<u8>,
|
|
|
|
|
job_timeout_sec: TimeSpan,
|
|
|
|
|
job_running_timeout_sec: TimeSpan,
|
|
|
|
|
job_timeout: TimeSpan,
|
|
|
|
|
job_running_timeout: TimeSpan,
|
|
|
|
|
job_timeout_action: UnitAction,
|
|
|
|
|
job_timeout_reboot_argument: Option<String>,
|
|
|
|
|
start_limit_interval_sec: FiniteTimeSpan,
|
|
|
|
|
start_limit_interval: FiniteTimeSpan,
|
|
|
|
|
start_limit_burst: usize,
|
|
|
|
|
start_limit_action: UnitAction,
|
|
|
|
|
reboot_argument: Option<String>,
|
|
|
|
@ -190,13 +187,13 @@ impl Unit {
|
|
|
|
|
.and_then(|x| x.parse::<u8>().ok())
|
|
|
|
|
.or(unit.success_action_exit_status);
|
|
|
|
|
|
|
|
|
|
unit.job_timeout_sec = section
|
|
|
|
|
unit.job_timeout = section
|
|
|
|
|
.get_time_span("JobTimeoutSec")
|
|
|
|
|
.unwrap_or(unit.job_timeout_sec);
|
|
|
|
|
.unwrap_or(unit.job_timeout);
|
|
|
|
|
|
|
|
|
|
unit.job_running_timeout_sec = section
|
|
|
|
|
unit.job_running_timeout = section
|
|
|
|
|
.get_time_span("JobRunningTimeoutSec")
|
|
|
|
|
.unwrap_or(unit.job_running_timeout_sec);
|
|
|
|
|
.unwrap_or(unit.job_running_timeout);
|
|
|
|
|
|
|
|
|
|
unit.job_timeout_action = section
|
|
|
|
|
.get_string("JobTimeoutAction")
|
|
|
|
@ -207,9 +204,9 @@ impl Unit {
|
|
|
|
|
.get_string("JobTimeoutRebootArgument")
|
|
|
|
|
.map(str::to_string);
|
|
|
|
|
|
|
|
|
|
unit.start_limit_interval_sec = section
|
|
|
|
|
unit.start_limit_interval = section
|
|
|
|
|
.get_finite_time_span("StartLimitIntervalSec")
|
|
|
|
|
.unwrap_or(unit.start_limit_interval_sec);
|
|
|
|
|
.unwrap_or(unit.start_limit_interval);
|
|
|
|
|
|
|
|
|
|
unit.start_limit_burst = section
|
|
|
|
|
.get_string("StartLimitBurst")
|
|
|
|
@ -275,11 +272,11 @@ impl Default for Unit {
|
|
|
|
|
success_action: UnitAction::None,
|
|
|
|
|
failure_action_exit_status: None,
|
|
|
|
|
success_action_exit_status: None,
|
|
|
|
|
job_timeout_sec: Infinite,
|
|
|
|
|
job_running_timeout_sec: Infinite,
|
|
|
|
|
job_timeout: Infinite,
|
|
|
|
|
job_running_timeout: Infinite,
|
|
|
|
|
job_timeout_action: UnitAction::None,
|
|
|
|
|
job_timeout_reboot_argument: None,
|
|
|
|
|
start_limit_interval_sec: Default::default(),
|
|
|
|
|
start_limit_interval: Default::default(),
|
|
|
|
|
start_limit_burst: 0,
|
|
|
|
|
start_limit_action: UnitAction::None,
|
|
|
|
|
reboot_argument: None,
|
|
|
|
@ -406,6 +403,5 @@ SuccessActionExitStatus=256
|
|
|
|
|
assert_eq!(unit.collect_mode, CollectMode::InactiveOrFailed);
|
|
|
|
|
assert_eq!(unit.success_action_exit_status, None);
|
|
|
|
|
assert_eq!(unit.failure_action_exit_status, Some(1));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|