psyinfra / onyo

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

New Feature: `onyo new` address configuration via `onyo.config` namespace #692

Open aqw opened 1 day ago

aqw commented 1 day ago

onyo new should be allowed to override the effective value of an onyo configuration key via the onyo.config namespace. This is specifically to handle the case of TSV files and the former template pseudo key (see #688).

For example: onyo.config.new.template=laptop temporarily sets the value of the onyo config key onyo.new.template to laptop for that asset(s).

This namespace should not be available to onyo get or onyo unset as the values have nothing to do with assets.

Open Questions:

TobiasKadelka commented 1 day ago

Should the namespace be addressable via --keys? Seems good to be consistent.

Normally I agree on the importance of consistency. However, in this case I wonder if we not have it seperate.

  1. I do not think about templates as a pseudo key, because it is not a real world aspect of an asset in the way directories or even git meta data like creation time are; and the implementation can reflect this difference.
  2. Does having --keys template=<...> actually add something (besides a lose feeling for consistency), or would it rather confuse and misdirect? I think for onyo new it is confusing, because it would feel (imagining a new user) like this is a permanent-ish asset characteristic, not just an easier way to add data.

So to me template is the first pseudo-key which is actually different. (In reality, I simply would never use it with --keys; but even on theoretical grounds I am against adding it because I think templates are a seperate thing, and we should reflect it in the implementation, instead of blurring these lines)