psyinfra / onyo

text-based inventory system on top of git
ISC License
3 stars 5 forks source link

Bug: `onyo edit` allows keynames containing `=` #718

Open aqw opened 2 weeks ago

aqw commented 2 weeks ago

onyo implicitly disallows keynames containing a =. Everything that accepts the syntax key=value splits on the first = found.

❱ onyo set --keys hah=hey=he --asset warehouse/desktop_dell_optiplex-7010.abc123
--- /home/aqw/git/inm7/inventory/warehouse/desktop_dell_optiplex-7010.abc123
+++ /home/aqw/git/inm7/inventory/warehouse/desktop_dell_optiplex-7010.abc123
@@ -24,3 +24,4 @@
   HDMI: 1
   DP: 1
   3-5: 1
+hah: hey=he

Quoting does not alter this, as it's swallowed by the shell before passing to Python.

I propose that = (like .) be explicitly disallowed (edit: just in the keyname). All commands will error (informatively) about using a verboten character.

bpoldrack commented 2 weeks ago

Agree. Just to be clear FTR:

I propose that = be explicitly disallowed (like .).

That's key names only, right?

aqw commented 2 weeks ago

Correct. Only the keyname.

I have updated the first comment in the the issue to make that explicit.