core: make "Restart" service property accessible via the transient API
Fixes: #4402
This commit is contained in:
parent
d2d6c096f6
commit
4ea0d7f431
|
@ -143,6 +143,29 @@ static int bus_service_set_transient_property(
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
} else if (streq(name, "Restart")) {
|
||||||
|
ServiceRestart sr;
|
||||||
|
const char *v;
|
||||||
|
|
||||||
|
r = sd_bus_message_read(message, "s", &v);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
if (isempty(v))
|
||||||
|
sr = SERVICE_RESTART_NO;
|
||||||
|
else {
|
||||||
|
sr = service_restart_from_string(v);
|
||||||
|
if (sr < 0)
|
||||||
|
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid restart setting: %s", v);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode != UNIT_CHECK) {
|
||||||
|
s->restart = sr;
|
||||||
|
unit_write_drop_in_private_format(UNIT(s), mode, name, "Restart=%s", service_restart_to_string(sr));
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
} else if (STR_IN_SET(name,
|
} else if (STR_IN_SET(name,
|
||||||
"StandardInputFileDescriptor",
|
"StandardInputFileDescriptor",
|
||||||
"StandardOutputFileDescriptor",
|
"StandardOutputFileDescriptor",
|
||||||
|
|
|
@ -266,7 +266,7 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
|
||||||
"StandardInput", "StandardOutput", "StandardError",
|
"StandardInput", "StandardOutput", "StandardError",
|
||||||
"Description", "Slice", "Type", "WorkingDirectory",
|
"Description", "Slice", "Type", "WorkingDirectory",
|
||||||
"RootDirectory", "SyslogIdentifier", "ProtectSystem",
|
"RootDirectory", "SyslogIdentifier", "ProtectSystem",
|
||||||
"ProtectHome", "SELinuxContext"))
|
"ProtectHome", "SELinuxContext", "Restart"))
|
||||||
r = sd_bus_message_append(m, "v", "s", eq);
|
r = sd_bus_message_append(m, "v", "s", eq);
|
||||||
|
|
||||||
else if (streq(field, "SyslogLevel")) {
|
else if (streq(field, "SyslogLevel")) {
|
||||||
|
|
Loading…
Reference in a new issue