-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Pretty print systemd services file #13814
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -266,7 +266,15 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman container run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --replace --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN "foo=arg \"with \" space" | ||||||||
ExecStart=/usr/bin/podman container run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--replace \ | ||||||||
--name jadda-jadda \ | ||||||||
--hostname hello-world awesome-image:latest command arg1 ... argN "foo=arg \"with \" space" | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -291,7 +299,15 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman container run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm -d --replace --sdnotify=container --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN "foo=arg \"with \" space" | ||||||||
ExecStart=/usr/bin/podman container run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
-d \ | ||||||||
--replace \ | ||||||||
--sdnotify=container \ | ||||||||
--name jadda-jadda \ | ||||||||
--hostname hello-world awesome-image:latest command arg1 ... argN "foo=arg \"with \" space" | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -316,7 +332,15 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --replace -d --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
--replace \ | ||||||||
-d \ | ||||||||
--name jadda-jadda \ | ||||||||
--hostname hello-world awesome-image:latest command arg1 ... argN | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -341,7 +365,16 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --pod-id-file %t/pod-foobar.pod-id-file --sdnotify=conmon --replace -d --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--pod-id-file %t/pod-foobar.pod-id-file \ | ||||||||
--sdnotify=conmon \ | ||||||||
--replace \ | ||||||||
-d \ | ||||||||
--name jadda-jadda \ | ||||||||
--hostname hello-world awesome-image:latest command arg1 ... argN | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -366,7 +399,15 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon --replace --detach --name jadda-jadda --hostname hello-world awesome-image:latest command arg1 ... argN | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
--replace \ | ||||||||
--detach \ | ||||||||
--name jadda-jadda \ | ||||||||
--hostname hello-world awesome-image:latest command arg1 ... argN | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -391,7 +432,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -417,7 +463,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=102 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon ` + | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
` + | ||||||||
detachparam + | ||||||||
` awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
|
@@ -446,7 +497,16 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=102 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --replace --name test -p 80:80 awesome-image:latest somecmd --detach=false | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--replace \ | ||||||||
--name test \ | ||||||||
-p 80:80 awesome-image:latest somecmd \ | ||||||||
--detach=false | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -471,7 +531,14 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=102 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman --events-backend none --runroot /root run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman \ | ||||||||
--events-backend none \ | ||||||||
--runroot /root run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -496,7 +563,12 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman container run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman container run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -521,7 +593,16 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --replace --name test --log-driver=journald --log-opt=tag={{.Name}} awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--replace \ | ||||||||
--name test \ | ||||||||
--log-driver=journald \ | ||||||||
--log-opt=tag={{.Name}} awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -546,7 +627,15 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --replace --name test awesome-image:latest sh -c "kill $$$$ && echo %%\\" | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--replace \ | ||||||||
--name test awesome-image:latest sh \ | ||||||||
-c "kill $$$$ && echo %%\\" | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -571,7 +660,16 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --conmon-pidfile=foo awesome-image:latest podman run --cgroups=foo --conmon-pidfile=foo --cidfile=foo alpine | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--conmon-pidfile=foo awesome-image:latest podman run \ | ||||||||
--cgroups=foo \ | ||||||||
--conmon-pidfile=foo \ | ||||||||
--cidfile=foo alpine | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -596,7 +694,18 @@ Environment=PODMAN_SYSTEMD_UNIT=%n | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --pod-id-file %t/pod-foobar.pod-id-file --sdnotify=conmon -d --conmon-pidfile=foo awesome-image:latest podman run --cgroups=foo --conmon-pidfile=foo --cidfile=foo --pod-id-file /tmp/pod-foobar.pod-id-file alpine | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--pod-id-file %t/pod-foobar.pod-id-file \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--conmon-pidfile=foo awesome-image:latest podman run \ | ||||||||
--cgroups=foo \ | ||||||||
--conmon-pidfile=foo \ | ||||||||
--cidfile=foo \ | ||||||||
--pod-id-file /tmp/pod-foobar.pod-id-file alpine | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -622,7 +731,16 @@ Environment=FOO=abc "BAR=my test" USER=%%a | |||||||
Restart=on-failure | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d --env FOO --env=BAR --env=MYENV=2 -e USER awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d \ | ||||||||
--env FOO \ | ||||||||
--env=BAR \ | ||||||||
--env=MYENV=2 \ | ||||||||
-e USER awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -648,7 +766,12 @@ Restart=on-failure | |||||||
StartLimitBurst=42 | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d awesome-image:latest | ||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
@@ -674,7 +797,13 @@ Restart=on-failure | |||||||
StartLimitBurst=42 | ||||||||
TimeoutStopSec=70 | ||||||||
ExecStartPre=/bin/rm -f %t/%n.ctr-id | ||||||||
ExecStart=/usr/bin/podman run --name=container-foo-%i --cidfile=%t/%n.ctr-id --cgroups=no-conmon --rm --sdnotify=conmon -d awesome-image:latest | ||||||||
ExecStart=/usr/bin/podman run \ | ||||||||
--name=container-foo-%i \ | ||||||||
--cidfile=%t/%n.ctr-id \ | ||||||||
--cgroups=no-conmon \ | ||||||||
--rm \ | ||||||||
--sdnotify=conmon \ | ||||||||
-d awesome-image:latest | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just curious why you didn't have the argument(s) on their own line for each of these ala:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The original patch did this, and it was felt that this did not look good, it broke the line up into two many lines. @Luap99 and I agreed this method looked best. |
||||||||
ExecStop=/usr/bin/podman stop --ignore --cidfile=%t/%n.ctr-id | ||||||||
ExecStopPost=/usr/bin/podman rm -f --ignore --cidfile=%t/%n.ctr-id | ||||||||
Type=notify | ||||||||
|
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.
and remove "sh" from line 637
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.
That is difficult/impossible to do, would need to figure out the first line of the command. Recall these are commands within commands. The command is not processed by Podman so there is no way to differentiate between the command/image and subcommand.
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.
It is possible to do this but it would require way more logic. I think the current check is good enough.
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.
While possible for certain use cases, like podman in podman, I am not sure we would be 100 successful in interpreting these type of commands imagine running chroot or sudo within a container, or even bash -c. It would get way more complex for not much benefit.