New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing Restart=on-failure for Type=oneshot #7474
Conversation
@@ -514,8 +514,8 @@ static int service_verify(Service *s) { | |||
return -EINVAL; | |||
} | |||
|
|||
if (s->type == SERVICE_ONESHOT && s->restart != SERVICE_RESTART_NO) { | |||
log_unit_error(UNIT(s), "Service has Restart= setting other than no, which isn't allowed for Type=oneshot services. Refusing."); | |||
if (s->type == SERVICE_ONESHOT && (s->restart != SERVICE_RESTART_NO && s->restart != SERVICE_RESTART_ON_FAILURE)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
!IN_SET(s->restart, SERVICE_RESTART_NO, SERVICE_RESTART_ON_FAILURE)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the tip
if (s->type == SERVICE_ONESHOT && s->restart != SERVICE_RESTART_NO) { | ||
log_unit_error(UNIT(s), "Service has Restart= setting other than no, which isn't allowed for Type=oneshot services. Refusing."); | ||
if (s->type == SERVICE_ONESHOT && (s->restart != SERVICE_RESTART_NO && s->restart != SERVICE_RESTART_ON_FAILURE)) { | ||
log_unit_error(UNIT(s), "Service has Restart= setting other than no or on-failure, which are the only allowed for Type=oneshot services. Refusing."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a word missing in that sentence:
which are the only [WHAT] allowed
Maybe "Illegal Restart= setting for service with Type=oneshot; only "no" and "on-failure" are allowed. Ignoring."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
true.
well, if we open this up we should probably open it up for all restart types, that conceptually can be made fit. quite frankly, i don't really see all the implications of this change. Let's please make sure this actually works properly: could you add a test case in test/TEST-… for this? |
I will work on some tests and think about the rest of types. |
I still think adding this would be good, but given the PR stalled, let's close this. |
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales.
…gnition dropin because apparently restarting oneshot units is not possible as reflected upon at systemd/systemd#7474 (re-opened at systemd/systemd#13796), because you know...systemd.
…gnition dropin because apparently restarting oneshot units is not possible as reflected upon at systemd/systemd#7474 (re-opened at systemd/systemd#13796), because you know...systemd.
Picked up from systemd#7474 , so coauthored by @robermorales. Cherry-Picked-From: 1g7q3xj2p5an8wrh4mpgf7zdb9xfqkdz7mbwdf6h8n1nr2n81iq1 Cherry-Picked-By: Niklas Hambüchen <mail@nh2.me>
Picked up from systemd#7474 , so coauthored by @robermorales.
Picked up from systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272)
Picked up from systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272)
Picked up from systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272)
Picked up from systemd/systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272) Resolves: #2042896
Picked up from systemd/systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272) Resolves: #2042896
Picked up from systemd/systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272) Resolves: #2042896
Picked up from systemd/systemd#7474 , so coauthored by @robermorales. (cherry picked from commit 10e7272) Resolves: #2042896
It partially solves #2582