Closed ride808 closed 1 year ago
The short answer is no. The task code implementations employ https://docs.python.org/3/library/configparser.html. There can be only one section
for task.csv-to-oscal-cd
per .config
file. Other sections are possible for other tasks in the same .config
file.
I can imagine that we could extend the trestle task command to take another flag, say --section <section-name>
, to override the default expected by each task. That way one could have one .config
file with several sections, but one would still need an explicit trestle task invocation for each section.
For example:
trestle task csv-to-oscal-cd --config my.config --section task.csv-to-oscal-cd.comp1
trestle task csv-to-oscal-cd --config my.config --section task.csv-to-oscal-cd.comp2
with changed entries in the .config
file such as:
[task.csv-to-oscal-cd.comp2]
title = comp2
version = 1.0.0
csv-file = /framework/oscal/trestle/csv-components/comp2.csv
output-dir = /framework/oscal/testle/component-definitions/
Comments?
@degenaro I was just trying to avoid the multiple trestle CLI task invocations per csv file that I was creating components from. Was hoping I'd be able to just make one csv import call from the cli. So, I'm not sure the solution proposed makes much of a difference to me but would I guess provide a bit of flexibility to the user.
I worked around my problem by just calling separate config files for each CSV I was importing.
trestle task csv-to-oscal-cd -c /framework/oscal/trestle/csv-components/csv1.config
trestle task csv-to-oscal-cd -c /framework/oscal/trestle/csv-components/csv2.config
Closing as working-as-designed. If more discussion is warranted, please re-open.
Question
Is it posible to put multiple tasks of the same type in a referenced config file? Something like:
csv.config file:
Reason for question
I'd like to have one config file so that I can run
trestle task csv-to-oscal-cd -c /framework/oscal/trestle/csv-components/csv.config
that runs all my csv to component import tasks. Seems like i'm missing something on how to build a trestle config file. Is it possible? I couldn't find any examples in the tutorials as most of the config files used only have a single task in them.Any support and help on this subject is appreciated.