amitfin / patch

Home Assistant Integration for patching HA's files
MIT License
2 stars 1 forks source link

Can't reload yaml configuration #33

Closed gamba69 closed 5 months ago

gamba69 commented 5 months ago

System Health details

System Information

version core-2024.4.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.6.20-haos
arch x86_64
timezone Europe/Kyiv
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 5000 Installed Version | 1.34.0 Stage | running Available Repositories | 1473 Downloaded Repositories | 25 HACS Data | ok
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 12.1 -- | -- update_channel | stable supervisor_version | supervisor-2024.03.1 agent_version | 1.6.0 docker_version | 24.0.7 disk_total | 457.7 GB disk_used | 45.9 GB healthy | true supported | true board | generic-x86-64 supervisor_api | ok version_api | ok installed_addons | Advanced SSH & Web Terminal (17.2.0), Samba share (12.3.1), Log Viewer (0.17.0), Glances (0.21.1), Home Assistant Google Drive Backup (0.112.1), MariaDB (2.6.1), Mosquitto broker (6.4.0), Zigbee2MQTT (1.36.1-1), phpMyAdmin (0.9.1), Traccar (0.25.0), Studio Code Server (5.15.0), Network UPS Tools (0.13.0), MQTT Explorer (browser-1.0.1), Let's Encrypt (5.0.15), NGINX Home Assistant SSL proxy (3.9.0), Run On Startup.d (0.11a), Speedtest (1.5.0), HDD Tools (1.1.0), OpenSpeedTest (v2.0.3)
Dashboards dashboards | 5 -- | -- resources | 7 views | 13 mode | storage
Recorder oldest_recorder_run | 2 февраля 2024 г. в 09:02 -- | -- current_recorder_run | 4 апреля 2024 г. в 15:08 estimated_db_size | 3974.86 MiB database_engine | mysql database_version | 10.6.12
Xiaomi Miot Auto component_version | 0.7.17 -- | -- can_reach_server | ok can_reach_spec | ok logged_accounts | 0 total_devices | 0

Checklist

Describe the issue

Error when reload yaml - all configuration or specific patch integration configuration

Reproduction steps

  1. Reload yaml configuration, all or specific patch integration

Debug logs

2024-04-05 10:38:31.994 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140110015905984] Secrets not supported in this YAML file
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2542, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2579, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/patch/__init__.py", line 102, in async_reload
    config = homeassistant.config.load_yaml_config_file(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config.py", line 542, in load_yaml_config_file
    conf_dict = load_yaml_dict(config_path, secrets)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 246, in load_yaml_dict
    loaded_yaml = load_yaml(fname, secrets)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 232, in load_yaml
    return parse_yaml(conf_file, secrets)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 261, in parse_yaml
    return _parse_yaml(FastSafeLoader, content, secrets)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 288, in _parse_yaml
    return yaml.load(content, Loader=lambda stream: loader(stream, secrets))  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 428, in _handle_mapping_tag
    nodes = loader.construct_pairs(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 155, in construct_pairs
    value = self.construct_object(value_node, deep=deep)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 338, in _include_yaml
    loaded_yaml = load_yaml(fname, loader.secrets)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 232, in load_yaml
    return parse_yaml(conf_file, secrets)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 261, in parse_yaml
    return _parse_yaml(FastSafeLoader, content, secrets)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 288, in _parse_yaml
    return yaml.load(content, Loader=lambda stream: loader(stream, secrets))  # type: ignore[arg-type]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/__init__.py", line 81, in load
    return loader.get_single_data()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 51, in get_single_data
    return self.construct_document(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 55, in construct_document
    data = self.construct_object(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 428, in _handle_mapping_tag
    nodes = loader.construct_pairs(node)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 155, in construct_pairs
    value = self.construct_object(value_node, deep=deep)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/yaml/constructor.py", line 100, in construct_object
    data = constructor(self, node)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/yaml/loader.py", line 496, in secret_yaml
    raise HomeAssistantError("Secrets not supported in this YAML file")
homeassistant.exceptions.HomeAssistantError: Secrets not supported in this YAML file

Diagnostics dump

No response

amitfin commented 5 months ago

What are you trying to achieve? Can you share the patch: section of your configuration (configuration.yaml). It's hard to tell from the logs, but my guess is that you have an invalid patch: section. Please verify your configuration against the documentation. (You can also validate it against the actual validation code which can be found here).

gamba69 commented 5 months ago

What are you trying to achieve? Can you share the patch: section of your configuration (configuration.yaml). It's hard to tell from the logs, but my guess is that you have an invalid patch: section. Please verify your configuration against the documentation. (You can also validate it against the actual validation code which can be found here).

patch: delay: 60 files:

All work fine. Files patches apply, after HA update patch initiate reload. But I can't reload yaml confg from developer panel, neither "all" no "patch" with error specified.

gamba69 commented 5 months ago

изображение

amitfin commented 5 months ago

Why do you think the problem is related to the patch integration? In both places, the log and the screenshot, it seems that the problem is related to secrets:

Secrets not supported in this YAML file

gamba69 commented 5 months ago

Why do you think the problem is related to the patch integration? In both places, the log and the screenshot, it seems that the problem is related to secrets:

Secrets not supported in this YAML file

Main reason: When I comment out patch configuration - all reload's work as usual. After uncommenting - this error rise again.

LordShadowen commented 1 week ago

I know this is closed, but have exactly the same issue, exactly as described by @gamba69 - and I'm hoping you could take a second look at this.

If I add a 'patch' section to my config, everything related to patching works great, but I can't reload YAML or do a quick reload - I get the same 'Secrets not supported in this YAML file' error and exact same error on the log.

If I comment out the section and restart HA, then everything goes back to normal.

I recognize it's a bit weird - doesn't seem related, and there's definitely nothing related to secrets going on... but the fact is, it happens :)