Open aqw opened 1 week ago
should mkdir (and the potential https://github.com/psyinfra/onyo/issues/648) convert templates?
Do you mean "should the command onyo mkdir <asset>
which converts an asset to an asset dir also convert a template to a template dir?"
If so, my current answer is "obviously not", because we do not allow any other commands to work in .onyo/
whatsoever, e.g.:
❱ onyo new --template display_dell_u2419hc -d .onyo/templates --edit 1 !
ERROR: /Users/tkadelka/inventory/.onyo/templates/display_dell_u2419hc.fauxhXpLAb is not a valid asset path.
❱ onyo cat .onyo/config 1 !
ERROR: The following paths are not assets:
/Users/tkadelka/inventory/.onyo/config
This was the end of my answer in regards to this issue, but I want to continue to think loudly about this point:
We had in the past discussions about allowing the onyo commands to potentially work in .onyo/
too. That would come with a bunch of costs and awkwardnesses, because the directory just works different, and just is not about inventoried assets.
But still, there might be some value in allowing onyo to work there in some capacity.
Some parts of validation would be handy to work in template/
(i.e. even if we know the template has not all keys required, we might still want to check if make: dell
is always written the same).
Furthermore, it always seemed obvious to me that onyo fsck
needs to check the existence of .onyo/
, and probably more aspects in it. So I am not completely and forever against the idea of allowing onyo commands to work under .onyo/
, I just think we should not just allow this one special case for the temp dir as an exeption, but consider as a whole how onyo actually should work with it.
This came out of our conversation about
--yaml
(#720 #722). There will be additional issues foronyo new
.However, templates and assets should be the same thing, just templates have less validation (i.e. all assets can be templates, not not all templates can be assets).
It should be possible to have a Template Directory (the analogue of an Asset Directory).
This would allow for nested assets and directories.
A user could specify the creation of an asset dir from a template in two ways:
onyo.is.directory: True
Open questions:
673 has an open question whether templates and directories should be
set
-able (andunset
). This is a reasonable use-case.mkdir
(and the potential #648) convert templates?