Merge pull request #33627 from YHNdnzj/systemctl-triggering-warning
systemctl: some fixes for active triggering unit warning
This commit is contained in:
+3
-3
@@ -2440,9 +2440,9 @@ Jan 12 10:46:45 example.com bluetoothd[8900]: gatt-time-server: Input/output err
|
||||
<term><option>--no-reload</option></term>
|
||||
|
||||
<listitem>
|
||||
<para>When used with <command>enable</command> and
|
||||
<command>disable</command>, do not implicitly reload daemon
|
||||
configuration after executing the changes.</para>
|
||||
<para>When used with <command>enable</command>, <command>disable</command>, <command>preset</command>,
|
||||
<command>mask</command>, or <command>unmask</command>, do not implicitly reload daemon configuration
|
||||
after executing the changes.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
|
||||
@@ -327,14 +327,15 @@ int get_active_triggering_units(sd_bus *bus, const char *unit, bool ignore_maske
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (unit_name_is_valid(name, UNIT_NAME_TEMPLATE))
|
||||
goto skip;
|
||||
|
||||
if (ignore_masked) {
|
||||
r = unit_is_masked(bus, name);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r > 0) {
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
if (r > 0)
|
||||
goto skip;
|
||||
}
|
||||
|
||||
dbus_path = unit_dbus_path_from_name(name);
|
||||
@@ -370,6 +371,10 @@ int get_active_triggering_units(sd_bus *bus, const char *unit, bool ignore_maske
|
||||
|
||||
*ret = TAKE_PTR(active);
|
||||
return 0;
|
||||
|
||||
skip:
|
||||
*ret = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void warn_triggering_units(sd_bus *bus, const char *unit, const char *operation, bool ignore_masked) {
|
||||
@@ -383,8 +388,8 @@ void warn_triggering_units(sd_bus *bus, const char *unit, const char *operation,
|
||||
|
||||
r = get_active_triggering_units(bus, unit, ignore_masked, &triggered_by);
|
||||
if (r < 0) {
|
||||
log_warning_errno(r,
|
||||
"Failed to get triggering units for '%s', ignoring: %m", unit);
|
||||
if (r != -ENOENT) /* A linked unit might have disappeared after disabling */
|
||||
log_warning_errno(r, "Failed to get triggering units for '%s', ignoring: %m", unit);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user