sabuto / hassio-telegraf

MIT License
28 stars 14 forks source link

Unable to use custom configuration outside of /share #37

Closed LilTrublMakr closed 3 years ago

LilTrublMakr commented 3 years ago

Type of Issue

Issue

Description of issue

When changing the custom_conf section of the configuration, you can not set any other value than the default value for location. If you do, and even if the file does exist on the host OS, the plugin errors out with No such file or directory.

My modified config (only the relevant section):

custom_conf:
  enabled: true
  location: /root/config/telegraf/telegraf.conf

If I do put the default value back in (and place a copy of telegraf.conf in it), it works as it should. So this works:

custom_conf:
  enabled: true
  location: /share/telegraf.conf

Not a huge bug but it would be nice for my OCD to be able to keep my config files in one place.

Logs

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] scripts: applying... 
[fix-attrs.d] scripts: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: Telegraf
 An addon to add telegraf to hassio.
-----------------------------------------------------------
 Add-on version: dev
 You are running the latest version of this add-on.
 System: Home Assistant OS 6.0  (amd64 / qemux86-64)
 Home Assistant Core: 2021.6.5
 Home Assistant Supervisor: 2021.06.3
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] telegraf.sh: executing... 
[09:59:27] INFO: Using custom conf file
cp: cannot stat '/root/config/telegraf/telegraf.conf': No such file or directory
[cont-init.d] telegraf.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

 We are so sorry, but something went terribly wrong when
 starting or running this add-on.

 Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.
foreground: warning: unable to spawn s6-nuke: Permission denied
[s6-finish] sending all processes the KILL signal and exiting.
sabuto commented 3 years ago

I think this has to do with the folders that addon's have access to. I tried making it fully configurable but addon's only have access to certain folders, i will look into it again :)

sabuto commented 3 years ago

try doing just /config instead of /root/config

LilTrublMakr commented 3 years ago

Yep, that works. Didn't realize that it was symlinked.

sabuto commented 3 years ago

https://github.com/Sabuto/hassio-telegraf/blob/master/telegraf/config.json#L25-L29 here are all the symlinked folders