dwainscheeren / dwains-lovelace-dashboard

An fully auto generating Home Assistant UI dashboard for desktop, tablet and mobile by Dwains for desktop, tablet, mobile
Other
1.77k stars 188 forks source link

os.mknod() requires superuser privileges on other platforms #316

Closed maikthulhu closed 2 years ago

maikthulhu commented 3 years ago

https://github.com/dwainscheeren/dwains-lovelace-dashboard/blob/b3e1bae3d8581bf234ddad9f6b2326d1f316e703/custom_components/dwains_dashboard/process_yaml.py#L280

Good morning! I'm running HASS in a FreeBSD jail (using TrueNAS) and ran into a minor issue when performing initial config and getting set up.

The error I received is: OSError: [Errno 22] Invalid argument

Unfortunately I didn't save the entire stack trace. I referenced process_yaml.py:280 (linked above) which points to os.mknod(path). It appears this call requires superuser privileges which prevents DD from loading. An appropriate user-level call is below. I can do a PR if you like but since it was just one line I figured it would take less time this way.

I replaced line 280 with: open(path, 'w').close()

This creates the (.installed) file if it doesn't exist and then closes the file handle. Nice and easy, though slightly less clean.

References: https://stackoverflow.com/questions/32115715/os-mknod-fails-on-macos

dwainscheeren commented 2 years ago

Thanks, patched in 2.0.4.