appdaemon icon indicating copy to clipboard operation
appdaemon copied to clipboard

Warning about "secrtets" from apps where yaml is commented out

Open Aephir opened this issue 1 year ago • 1 comments

What happened?

Whenever, I comment out some app in yaml, if that app config contains a reference to secrets.yaml, I get a warning in the logs.

To be clear: This happens when the yaml is commented out, not when it is uncommented. When I remove the comments, everything just works with no warnings.

It loads values from secrets.yaml just fine when the yaml is not commented. I also have a Home Assistant Community post about this.

FYI: The Addon does not report AppDaemon version, it just shows it as 4.x. I am musing the Addon v0.16.4

Version

4.x

Installation type

Home Assistant add-on

Relevant log output

2024-02-12 12:47:09.633652 WARNING AppDaemon: File '/config/apps/test/test.yaml' invalid structure - ignoring
2024-02-12 12:47:09.636354 WARNING AppDaemon: ------------------------------------------------------------
2024-02-12 12:47:09.636763 WARNING AppDaemon: Unexpected error loading config file: /config/apps/shopping_and_inventory/shopping_and_inventory.yaml
2024-02-12 12:47:09.637404 WARNING AppDaemon: ------------------------------------------------------------
2024-02-12 12:47:09.638709 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/appdaemon/app_management.py", line 578, in read_config_file
    return utils.read_config_file(file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 586, in read_config_file
    return read_yaml_config(path)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/appdaemon/utils.py", line 724, in read_yaml_config
    if "secrets" in config:
       ^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

Relevant code in the app or config file that caused the issue

Only the version WITH comments as shown here is problematic.

#test:
#    module: test
#    class: Test
#    ar: !secret autoremote_url_start
#    test_list: ["input_boolean.basement_lights_motion_control", "input_boolean.tv_room_lights_motion_control"]
#    grocy_api_key: !secret grocy_api_key
#    pin_automation: !secret alarm_code_automation

Anything else?

No response

Aephir avatar Feb 12 '24 12:02 Aephir

Same issue here. But it doesn't look like it negatively affects anything, so it can probably be ignored. Seems like a misleading warning though :thinking:

2024-12-03 02:29:36.019571 WARNING AppDaemon: File '/conf/apps/lighting/daylight.yaml' invalid structure - ignoring
2024-12-03 02:29:36.019087 WARNING AppDaemon: ------------------------------------------------------------
TypeError: argument of type 'NoneType' is not iterable
if "secrets" in config:
File "/usr/local/lib/python3.10/site-packages/appdaemon/utils.py", line 724, in read_yaml_config
return read_yaml_config(path)
File "/usr/local/lib/python3.10/site-packages/appdaemon/utils.py", line 586, in read_config_file
return utils.read_config_file(file)
File "/usr/local/lib/python3.10/site-packages/appdaemon/app_management.py", line 577, in read_config_file
2024-12-03 02:29:36.018931 WARNING AppDaemon: Traceback (most recent call last):
2024-12-03 02:29:36.017910 WARNING AppDaemon: ------------------------------------------------------------
2024-12-03 02:29:36.017801 WARNING AppDaemon: Unexpected error loading config file: /conf/apps/lighting/daylight.yaml
2024-12-03 02:29:36.017646 WARNING AppDaemon: ------------------------------------------------------------
2024-12-03 02:29:35.982189 INFO AppDaemon: Reading config

markusressel avatar Dec 03 '24 01:12 markusressel