diff --git a/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs b/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs index 348f7cae5d65..fce4abcd997c 100644 --- a/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs +++ b/pkgs/by-name/sw/switch-to-configuration-ng/src/main.rs @@ -604,7 +604,7 @@ fn compare_units(current_unit: &UnitInfo, new_unit: &UnitInfo) -> UnitComparison return UnitComparison::UnequalNeedsRestart; } } - } else if section_name == "Exec" + } else if section_name == "Service" && ini_cmp.len() == 1 && ini_cmp.contains_key("ExecReload") { @@ -2668,6 +2668,23 @@ invalid ) == super::UnitComparison::UnequalNeedsReload ); + // ExecReload added to an existing [Service] section + assert!( + super::compare_units( + &HashMap::from([( + "Service".to_string(), + HashMap::from([("ExecStart".to_string(), vec!["x".to_string()])]) + )]), + &HashMap::from([( + "Service".to_string(), + HashMap::from([ + ("ExecStart".to_string(), vec!["x".to_string()]), + ("ExecReload".to_string(), vec!["y".to_string()]), + ]) + )]), + ) == super::UnitComparison::UnequalNeedsReload + ); + assert!( super::compare_units( &HashMap::from([(