Closed stefanbschneider closed 6 years ago
We might need developers to tell us what file types they add. (we could try to autodetect based on file endings where possible, maybe there are MIME type libraries that help here)
tng-project add -t 'application/octet-stream' folder/folder/myvnf.qcow2
This should give a great workflow for developers. I have some further ideas which I write down here, to remember them.
We might want to also support wildcards and stuff:
tng-project add <subfolder>/*
But this is nothing for v0 or even v1 :-)
When we have wildcards, it might also make sense to have a .tngignore
file in a project. :-D
python-magic can detect MIME types without fileendings. But it just returns text/plain
for all .yml
files as it can't distinguish between VNFDs and NSDs.
I guess, we'll have to build something ourselves here or simply require users to specify what they are adding. Maybe using a few different flags like tng-project add --vnfd sample.yml
or --image
.
Yes that sounds good. I guess we need a combination:
with this three things we should be able to detect most things used in packages. and if they do not work, a manual fallback can be used.
Extension for later: Optional --tag
option that allows to add tags to be used in the NAPD
Optional --type
option to set the MIME type manually. This might be necessary when we can't detect the file type (e.g., of OSM descriptors). In this case we should throw a warning, use a best-effort categorization, and ask the user to provide the type manually.
We planned to determine the MIME/type of descriptors based on their descriptor_schema
, e.g., https://raw.githubusercontent.com/sonata-nfv/tng-schema/master/service-descriptor/nsd-schema.yml
.
Should we try to guess the type by slicing this URL (e.g., into nsd-schema
)? But this isn't very clean and breaks if we move or rename the schema.
Alternatively, we could add the MIME/type directly in the descriptors such that it can be read directly instead of descriptor_schema
.
Also, what about Sonata/Tango yaml files without descriptor_schema
? For example, FSMs and SSMs don't even seem to have schemas. And what are "patterns"? Do we need all this in Tango?
Closed by PR #12
Similar to git,
tng-project add <file>
should add the specified file to project.yaml, so it's packaged by the packager. Vice versa,tng-project reset/remove
removes it from project.yaml, so it is ignored by the packager