alexbelgium / hassio-addons

My homeassistant addons
MIT License
1.56k stars 223 forks source link

🐛 [addons_updater] Creates blank config.json if use config.yaml #1615

Closed jdeath closed 1 month ago

jdeath commented 1 month ago

Description

If an addon is made with a config.yaml, the addons_updater will update config.yaml correctly, but it also commits a blank config.json . It causes a supervisor error in the log, but addon still loads.

After resisting using yaml format, I now like it. It allows you to map directories to non-standard paths. Thus /addon_configs/XXXXX_addon can go to /config or /anything_you_want inside the container. This feature often helps avoids needing seds or run.sh .


2024-10-20 22:01:53.706 ERROR (SyncWorker_5) [supervisor.utils.json] Can't read json from /data/addons/git/2effc9b9/stirling-pdf/config.json: Input is a zero-length, empty document: line 1 column 1 (char 0)
2024-10-20 22:01:53.706 WARNING (SyncWorker_5) [supervisor.store.data] Can't read /data/addons/git/2effc9b9/stirling-pdf/config.json from repository 2effc9b9

Reproduction steps

1. Create/publish an addon with a config.yaml instead of config.json
2. Setup the updater.json correctly.
3. run addon_updater
4. a blank config.json is committed. the config.yaml is updated properly

Addon Logs

-----------------------------------------------------------
 Add-on: Repository Updater
 Automatic addons update by aligning version tag with upstream releases
-----------------------------------------------------------
 Add-on version: 3.19.9
 You are running the latest version of this add-on.
 System: Home Assistant OS 13.2  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.10.3
 Home Assistant Supervisor: 2024.10.2

Architecture

amd64

OS

HAos

alexbelgium commented 1 month ago

Hi, this should solve it! Thanks for the report and the pointer about the advantage of config.yaml, I will then surely follow your example too!

jdeath commented 1 month ago

Thanks. I'll close issue after I confirm it works. My updates are all up to date right now!