switch-to-configuration-ng: Fix ExecReload check for added key
The branch handling "a key was added to an existing section" compared the section name against "Exec" (the .nspawn section header) instead of "Service", so adding ExecReload= to a [Service] that previously lacked it still triggered a restart instead of a reload. Add a unit test covering this path.
This commit is contained in:
@@ -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([(
|
||||
|
||||
Reference in New Issue
Block a user