ARPA-SIMC / arkimet

A set of tools to organize, archive and distribute data files.
Other
15 stars 5 forks source link

arki-scan creates invalid conf if the input is a config file #265

Closed brancomat closed 3 years ago

brancomat commented 3 years ago

Let's say we have a dataset path populated with subdirectries with dataset config files.

This creates a working config:

arki-mergeconf /arkivio/arkimet/dataset/* -o config

The generated output looks like this:

[adroms2k]
__logname = SIMC;AROMS
archive age = 30
description = Operational sea circulation model of the Adriatic Sea (last 30 days)
filter = origin:GRIB1,200,,200 ; area:GRIB:type=3,latfirst=39756000,lonfirst=17715000
index = reftime, timerange, level, product
name = adroms2k
path = /arkivio/arkimet/dataset/adroms2k
postprocess = seriet
replace = yes

This should be equivalent, but it isn't:

arki-mergeconf /arkivio/arkimet/dataset/*/config -o config

The generated output looks like this:

[/arkivio/arkimet/dataset/adroms2k/config]
format = arkimet
name = /arkivio/arkimet/dataset/adroms2k/config
path = /arkivio/arkimet/dataset/adroms2k/config
type = file

that results in an invalid config (type=file is meant for GRIB/BUFR files) and it's not coherent with arki-mergeconf manpage (the config files should be valid sources).

spanezz commented 3 years ago

What's happening is that arkimet sees a file, doesn't recognise the extension, and defaults to reading it as the result of an arki-query (without --inline or other switches).

I can see that the filename is config and read it as a config file. However, arki-mergeconf also needs the name of the dataset, that is not in the config file.

Shall I say that if a path passed to arki-mergeconf is in the format .../$dirname/config, then I parse config as a configuration file, and add [$dirname] and name=$dirname to it?

spanezz commented 3 years ago

We can change various arkimet tools not to fallback to some arbitrary format if the file name has no known extension, but to give an error instead.

So:

brancomat commented 3 years ago

Ok for me and @edigiacomo