Add handling for imagestream status with no tags
- Dominant language
- Python
- Stars
- 7
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
While trying to run AppAssessment in the `bdec76-` namespace, I found in the [`initialload` pod](https://github.com/bcgov/AppAssessment/blob/7fe74e44d425f768a7a8cc4ced8c28550e0a5ebd/template/appassessment-template.yaml#L238) that the `./build/report.py` run would fail with this `KeyError` error output in the logs:
```
Traceback (most recent call last):
File "./report.py", line 345, in
writeReport(args.o, results, namespace, checksInfo, clusterName, podsWithFailedChecks)
File "./report.py", line 194, in writeReport
imagestreamSize = getImageStreamSize(namespace)
File "./report.py", line 74, in getImageStreamSize
if len(imagestream['status']['tags']) > 0:
KeyError: 'tags'
```
We should gracefully handle this case where an `imagestream.status` object has no `tags` key, either by:
- displaying something in the final report indicating what might be missing from our app configuration, or
- including a `hasattr()` check before trying to access this property [here](https://github.com/bcgov/AppAssessment/blob/main/build/report.py#L74) to enable the report to be generated as expected
**Definition of done**
- [ ] Code is updated such that AppAssessment can be successfully run against a namespace whether all `imagestream.status` objects have a `tags` property or not
- [ ] If it is deemed valuable to highlight the fact that an `imagestream.status` object has no `tags` property, this information appears in the generated report
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in build/report.py at getImageStreamSize(), especially line 74, and reproduce the report run against a namespace whose imagestream.status lacks tags. Trace how the resulting size is used in writeReport(). Done means AppAssessment generates its report for both imagestream shapes, with any chosen missing-tags information reflected in the final report.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100