For now, the directive is for demo purposes and a good start for future enhancements. Fixes T693
Details
- Reviewers
kparal tflink jskladan - Maniphest Tasks
- T693: Create Directive for Generating Reports from Template
- Commits
- rLTRNabc230c2bb2e: Add report directive
Run a check (I tested with rpmlint and upgradepath). Usage is included in the directive's documentation. Simple unittest included.
Diff Detail
- Repository
- rLTRN libtaskotron
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
@tflink said that it would be useful for tasks to be able to provide their own jinja template, so that's a feature you might want to add.
libtaskotron/directives/report_directive.py | ||
---|---|---|
19–22 ↗ | (On Diff #1888) | I got confused a little when I first read the description, because it says what the value is, but not what it is for. Also, we talked about some changes in behavior in person. Last but not least, we should use default: value statement here so that it's rendered in the documentation matrix in the same way as the other directives are. So what about: path: required: false description: | A path and a filename of the generated HTML report. You should always use relative paths, and ``${artifactsdir}`` is considered to be the base directory. All missing directories will be created automatically. Example: ``reports/overview.html`` type: str default: report.html |
25 ↗ | (On Diff #1888) | We now have this in executor.py: self.arg_data['checkname'] = self.task_data['name'] So it should never happen we don't know the check name. But we might want to extend this error to cases when directory creation fails for custom path. |
42 ↗ | (On Diff #1888) | I'm a bit worried that people will understand this not as a noun "report" (as in create a report) but as a verb "report" (as in report results), and confuse this directive with resultsdb directive. I'd rather call this create_report, generate_report, create_html, generate_html, pretty_report, something along those lines. |
44 ↗ | (On Diff #1888) | Since with the proposed change we base it off of ${arfifactsdir}, I would not include ../ here, maybe skip it completely for the trivial example (use the default name). |
60 ↗ | (On Diff #1888) | Thoughts whether we want to have this in /usr/lib/python/site-packages/ or somewhere else? @tflink? |
66–67 ↗ | (On Diff #1888) | As said above, I think this is not needed anymore. And we can remove this from resultsdb_directive as well. |
80 ↗ | (On Diff #1888) | Again, should not be needed. |
Can you post/paste the example you used to test this somewhere? I'm thinking about adding it to the workshop tomorrow.
Also, we should file an RFE to have the output file name not be hardcoded