Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

robermorales
Copy link

It partially solves #2582

@@ -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)) {
Copy link
Member

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)

Copy link
Author

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.");
Copy link
Member

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."?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true.

@keszybz keszybz added the reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks label Dec 5, 2017
@poettering
Copy link
Member

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?

@poettering poettering added the pid1 label Dec 5, 2017
@robermorales
Copy link
Author

I will work on some tests and think about the rest of types.

@poettering
Copy link
Member

I still think adding this would be good, but given the PR stalled, let's close this.

@poettering poettering closed this Apr 2, 2019
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 8, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 9, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 9, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 10, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 10, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 11, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 14, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
claudiozz added a commit to claudiozz/systemd that referenced this pull request Oct 16, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.
arizvisa added a commit to arizvisa/lolfuzz3 that referenced this pull request Oct 22, 2019
…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.
arizvisa added a commit to arizvisa/lolfuzz3 that referenced this pull request Oct 22, 2019
…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.
nh2 pushed a commit to nh2/systemd that referenced this pull request Nov 2, 2019
Picked up from systemd#7474 , so
coauthored by @robermorales.

Cherry-Picked-From: 1g7q3xj2p5an8wrh4mpgf7zdb9xfqkdz7mbwdf6h8n1nr2n81iq1
Cherry-Picked-By: Niklas Hambüchen <mail@nh2.me>
chpatrick pushed a commit to chpatrick/systemd that referenced this pull request Mar 26, 2020
bluca pushed a commit to bluca/systemd that referenced this pull request Apr 23, 2020
Picked up from systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)
bluca pushed a commit to bluca/systemd that referenced this pull request Jul 9, 2021
Picked up from systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)
russell-islam pushed a commit to russell-islam/systemd that referenced this pull request Jul 21, 2021
Picked up from systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)
dtardon pushed a commit to dtardon/systemd-rhel8 that referenced this pull request May 31, 2022
Picked up from systemd/systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)

Resolves: #2042896
dtardon pushed a commit to dtardon/systemd-rhel8 that referenced this pull request Jun 23, 2022
Picked up from systemd/systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)

Resolves: #2042896
systemd-rhel-bot pushed a commit to redhat-plumbers/systemd-rhel8 that referenced this pull request Jul 11, 2022
Picked up from systemd/systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)

Resolves: #2042896
dtardon pushed a commit to redhat-plumbers/systemd-rhel8 that referenced this pull request Jul 18, 2022
Picked up from systemd/systemd#7474 , so
coauthored by @robermorales.

(cherry picked from commit 10e7272)

Resolves: #2042896
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pid1 reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks
Development

Successfully merging this pull request may close these issues.

None yet

3 participants