dummylabs / thewatchman

Home Assistant custom integration to keep track of missing entities and actions in your config files
MIT License
476 stars 20 forks source link

Problem with dead symlinks #37

Closed RoboMagus closed 2 years ago

RoboMagus commented 2 years ago

I was browsing my home assistant error logs and I found this:

This error originated from a custom integration.

Logger: homeassistant
Source: custom_components/watchman/utils.py:255
Integration: Watchman (documentation, issues)
First occurred: 20:35:04 (1 occurrences)
Last logged: 20:35:04

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/watchman/__init__.py", line 257, in async_on_home_assistant_started
    parse_config(hass, reason="HA restart")
  File "/config/custom_components/watchman/__init__.py", line 330, in parse_config
    entity_list, service_list, files_parsed, files_ignored = parse(
  File "/config/custom_components/watchman/utils.py", line 255, in parse
    for i, line in enumerate(open(yaml_file, encoding="utf-8")):
FileNotFoundError: [Errno 2] No such file or directory: '/config/ext/crowdsec/parsers/http-logs.yaml'

I'm mounting some shared volumes into home assistant so I can modify their configurations within automations, one of which belongs to CrowdSec. Sadly this places a bunch of symlinks into that directory which, when not inside the CrowdSec image, result into inaccesible symlinks.

For my config I'll just add anything external to the ignore list, but properly handling this exception would improve this plugin. By the way; Love the insight this gives me! Takes a lot of the gueswork out of cleaning up old deprecated stuff from my configuration.

dummylabs commented 2 years ago

Fixed in v0.5.3.