-
I couldn't find an example to match the following scenario: podman run --name api-server --detach --tty \
--volume ~/.ara/server:/opt/ara:z -p 8000:8000 \
docker.io/recordsansible/ara-api:latest I tried to break this up several ways: - name: pypyr.steps.cmd
comment: run the ara API server in a podman container
in:
cmd:
'podman run \
--name api-server \
--detach \
--tty \
--volume ~/.ara/server:/opt/ara \
-p 8000:8000 \
docker.io/recordsansible/ara-api:latest' as well as trying a multi line quote using - name: pypyr.steps.cmd
comment: run the ara API server in a podman container
in:
cmd:
- podman
- run:
- --name api-server
- --detach
- --tty
- --volume ~/.ara/server:/opt/ara
- -p 8000:8000
- docker.io/recordsansible/ara-api:latest
``` |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @blaisep, you were very almost there! Instead of
This will pass So this way you can break up your cmd over multiple lines in the yaml however you want, and then under the hood they will get folded back up into a single line when passed to the subprocess. FYI, your second example would deffo not work, but it might be instructive to explain why. . . - name: pypyr.steps.cmd
in:
cmd:
- cmd1 --arg
- cmd2 --blah
- cmd3 --arb --arg This will run cmd1, and then cmd2, and then cmd3. In other words, these are separate commands that run separately - each of these spawn their own subprocess, if you want to get technical about it. It's not "one cmd" spread over multiple lines. |
Beta Was this translation helpful? Give feedback.
-
Oh wow, TIL about folding with Thank you. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the question @blaisep, this is a good one - I have added a section to the help docs explaining the same so hopefully future pypyristas with the same question can have an immediate answer! https://pypyr.io/docs/steps/cmd/#split-long-command-over-multiple-lines |
Beta Was this translation helpful? Give feedback.
Hi @blaisep, you were very almost there! Instead of
|-
(keep newlines, no newline at end) you should just be using>
(folded, replace newlines w spaces).This will pass
echo one two three
to the subprocess.So this way you can break up your cmd over multiple lines in the yaml however you want, and then under the hood they will get folded back up into a single line when passed to the subprocess.
FYI, your second example would deffo not work, but it might be instructive to explain why. . .
when you go