Download creates empty synthetic-locations config if only PUBLIC locations exists
UnseenWizzard opened this issue · 0 comments
Describe the bug
monaco download will create an empty synthetic-locations config folder, if only PUBLIC locations exist.
This is due the download of individual configurations checking and ignoring PUBLIC locations and only downloading manually created PRIVATE ones, while the yaml creation does not check if there's actually only downloaded locations.
This will result in the creation of:
synthetic-location/
synthetic-location.yaml
with synthetic-location.yaml
containing only:
config: []
How to reproduce
Steps to reproduce the behavior:
- download synthetic-location from an environment without private locations
(monaco download -e {env yaml} -p synthetic-location
Expected behavior
No synthetic-location config folder is created at all.
Implementation Hints/Notes
This is located in pkg/download
.
Specifially in download.go:createConfigsFromAPI()
the config folder is created, config files are written with jsoncreator.go (or not) and the yaml is written with yamlcreator.go.
While this method has an early exit if no data is returned at all from the API, further sorting like "is a synthetic location PUBLIC at all" happens in jsoncreator.go, without download actutally noticing that no files are written. That needs to change.