google / google/slo-generator

🐛 [BUG] - Loading SLOs from directory only loads `.yaml` files

Open
#311 3 comments 0 reactions 1 assignee Assigned to @mveroone View on GitHub
bug
Dominant language
Python
Stars
564
Forks
88
PR merge metrics
No merged PRs in 30d

Description

### SLO Generator Version

2.3.3

### Python Version

3.7.7

### What happened?

When Loading SLOs from a directory (`compute -f /etc/cronfig/slos -c config.yaml`), this code is executed :
https://github.com/google/slo-generator/blob/master/slo_generator/utils.py#L64

And thus, only `.yaml` files are loaded, while the docs says any YAML or JSON file works.

I found out the hard way spending a lot of time trying to figure out why my `.yml` was only loaded if named explicitly.
Same as last time, I'll gladly work on a PR but we're still trying to figure out how to consistently sign CLAs company-wide. I hope to get this sorted by mid-January

### What did you expect?

Any json/yml/yaml file would be loaded.
Ideally, all files would be loaded and tested for any of those 2 formats before being read or not.

### Relevant log output

```shell
slo_generator.utils - DEBUG - Path '/etc/config/slos' not found. Trying to load from string
slo_generator.utils - ERROR - Error serializing config into dict. This might be due to a syntax error in the YAML / JSON config file.
slo_generator.utils - DEBUG - '/etc/config/slos'
```

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.