psyinfra / onyo

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

`onyo new --template <path>` does not work with absolute path #593

Open TobiasKadelka opened 4 months ago

TobiasKadelka commented 4 months ago

onyo new --template expects just the template name, or alternatively the absolute path.

❱ onyo new --keys directory=shelf --template /Users/tkadelka/onyo/.onyo/templates/laptop.example
The following will be created:
+/Users/tkadelka/onyo/shelf
--- 
[....... rest of git diff ........]

❱ onyo new --keys directory=shelf --template .onyo/templates/laptop.example                                                   1 !
ERROR: Template .onyo/templates/laptop.example does not exist.

The relative path should work for --template too.

aqw commented 4 months ago

This feels weird, but Onyo allows it for addressing assets.

I assume we want to enforce that it must be a template in the same Onyo repository? Or do we want to allow using templates from anywhere on the FS?

TobiasKadelka commented 3 months ago

Or do we want to allow using templates from anywhere on the FS?

I personally think we want to allow templates (and tsv tables) from anywhere. Obviously in our use-cases we would prefer to have them added to the inventory repository. But since we verify newly created assets independently from their templates (and they are afterwards fully detached from them), I would not see why we would actively disallow specifying a path outside the inventory for this.

Possible use cases: