mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 23:21:22 +03:00
Merge pull request #14441 from GothAck/gothack_type.d_dropin_test_master
Fix type.d drop-in ordering for #14439 - duplicate against master
This commit is contained in:
commit
cb68406c6a
@ -236,6 +236,10 @@ int unit_file_find_dropin_paths(
|
||||
|
||||
assert(ret);
|
||||
|
||||
SET_FOREACH(name, names, i)
|
||||
STRV_FOREACH(p, lookup_path)
|
||||
(void) unit_file_find_dirs(original_root, unit_path_cache, *p, name, dir_suffix, &dirs);
|
||||
|
||||
/* All the names in the unit are of the same type so just grab one. */
|
||||
name = (char*) set_first(names);
|
||||
if (name) {
|
||||
@ -247,7 +251,7 @@ int unit_file_find_dropin_paths(
|
||||
"Failed to to derive unit type from unit name: %s",
|
||||
name);
|
||||
|
||||
/* Special top level drop in for "<unit type>.<suffix>". Add this first as it's the most generic
|
||||
/* Special top level drop in for "<unit type>.<suffix>". Add this last as it's the most generic
|
||||
* and should be able to be overridden by more specific drop-ins. */
|
||||
STRV_FOREACH(p, lookup_path)
|
||||
(void) unit_file_find_dirs(original_root,
|
||||
@ -258,10 +262,6 @@ int unit_file_find_dropin_paths(
|
||||
&dirs);
|
||||
}
|
||||
|
||||
SET_FOREACH(name, names, i)
|
||||
STRV_FOREACH(p, lookup_path)
|
||||
(void) unit_file_find_dirs(original_root, unit_path_cache, *p, name, dir_suffix, &dirs);
|
||||
|
||||
if (strv_isempty(dirs)) {
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
|
@ -117,6 +117,30 @@ EOF
|
||||
clear_services a b c
|
||||
}
|
||||
|
||||
test_hierarchical_dropins () {
|
||||
echo "Testing hierarchical dropins..."
|
||||
echo "*** test service.d/ top level drop-in"
|
||||
create_services a-b-c
|
||||
check_ko a-b-c ExecCondition "/bin/echo service.d"
|
||||
check_ko a-b-c ExecCondition "/bin/echo a-.service.d"
|
||||
check_ko a-b-c ExecCondition "/bin/echo a-b-.service.d"
|
||||
check_ko a-b-c ExecCondition "/bin/echo a-b-c.service.d"
|
||||
|
||||
for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
|
||||
mkdir -p /usr/lib/systemd/system/$dropin
|
||||
echo "
|
||||
[Service]
|
||||
ExecCondition=/bin/echo $dropin
|
||||
" > /usr/lib/systemd/system/$dropin/override.conf
|
||||
check_ok a-b-c ExecCondition "/bin/echo $dropin"
|
||||
done
|
||||
for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
|
||||
rm -rf /usr/lib/systemd/system/$dropin
|
||||
done
|
||||
|
||||
clear_services a-b-c
|
||||
}
|
||||
|
||||
test_template_dropins () {
|
||||
echo "Testing template dropins..."
|
||||
|
||||
@ -433,6 +457,7 @@ test_invalid_dropins () {
|
||||
}
|
||||
|
||||
test_basic_dropins
|
||||
test_hierarchical_dropins
|
||||
test_template_dropins
|
||||
test_alias_dropins
|
||||
test_masked_dropins
|
||||
|
Loading…
Reference in New Issue
Block a user