grlx icon indicating copy to clipboard operation
grlx copied to clipboard

[BUG] Problems with interpreting shell commands

Open johnmckenna-snd opened this issue 1 year ago • 2 comments

Please describe the issue. I've been having some problems interpreting shell commands specifically with things like "" empty strings or | pipes.

I have found a work around using the go templating bit like this:

  generate-cert:
    cmd.run:
      - name: ssh-keygen -t ed25519 -C <comment> -q -N {{ "" }} -f <file>
      - runas: user

Additionally, there's some more weirdness depending on what you do with your command like this one for adding docker to the apt registry.

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

This one I work around by writing the poopy command to a shell script then running that then deleting the file, which works but is a bit clunky.

Version Information

  • Commit [
  • Systems
    • Farmer OS Distribution: [ubuntu]
    • Sprout(s) OS Distribution(s): [debian]
CLI Version:
	Tag: v1.0.4
	Commit: 42a8b65
	Arch: darwin
	Compiler: go1.22.3
Farmer Version:
	Tag: v1.0.4
	Commit: 42a8b65
	Arch: linux
	Compiler: go1.22.3

Does this bug exist on the tip of master? [x] Yes [ ] No

johnmckenna-snd avatar Aug 12 '24 22:08 johnmckenna-snd

Does the issue still exist when you use a YAML multiline string instead of trying to get it to work in a kv value pairing?

taigrr avatar Aug 12 '24 22:08 taigrr

I tried that, but the mutliline string just hangs with no errors until the cook times out. It seems like there's a parsing issue with it which I wasn't able to suss out from the code. I checked the logs with journalctl on the sprout and the cook never even got executed.

- name: |
   string
   string

johnmckenna-snd avatar Aug 12 '24 23:08 johnmckenna-snd