* Docker events based watchdog
* Separate monitor from DockerAPI since it needs coresys
* Move monitor into dockerAPI
* Fix properties on coresys
* Add watchdog tests
* Added tests
* pylint issue
* Current state failures test
* Thread-safe event processing
* Use labels property
* Output backup log on error
* Apply suggestions from code review
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
* Cleanup API / old rebranding
* cleanup p2
* next round
* better comments
* cleanup import
* support only installed add-ons
* legacy migration
* test fixes
* add old env back
* revert for Core
* fix issues with old core
* fix
* using installed short cat
* revert
* extend legacy
* cleanup
* fix path
* Fix missing
* add stop
* readd old token
* Add minimal
* extend attributes
* Add repo back
* add more repo info
* Make it working
* Bump frontend to e7848262 (#3680)
* Add icon
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
* Move repository urls to store settings file
* Remove default repos from supervisor config
* Fix clone at initial store load
* Mock git load in repository fixture
* OS latest version set from upgrade path
* fix tests
* Update test_updater.py
* Revert / fetch_update is global unwrapped
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
* Create issue for detected DNS server problem
* Validate behavior on restart as well
* tls:// not supported, remove check
* Move DNS server checks into resolution checks
* Revert all changes to plugins.dns
* Run DNS server checks if affected
* Mock aiodns query during all checks tests
* Handle TarError/OSError in Core config backup routine
Make sure to handle TarError and OSError exceptions and print a warning
when backing up the Home Assistant Core config folder. This restores
behavior before the introduction of Backup notification in #3305.
* Reraise errors during HA Core backup
* Raise BackupError when encountering error during Add-on Backup
* Log to error as well
Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
The CLI plug-in stays up even without command. This saves a few
kilobytes of RAM.
It also allows s6-overlay's stage2 to complete. The stage2 execlineb
process has an enormously long cmdline, with strings like "init-stage2
failed" in it. This has previously led people to belive that there is a
problem (while there isn't). So as a side effect, getting stage2 to
complete side steps such confusion and makes the list of processes
cleaner.
* Revert "Disable CAS until it work (#3504)"
This reverts commit 435241bccf.
* Revert exception that are not forwarded
* enable for add-ons
* Apply suggestions from code review
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
* fix black
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
* Using CAS for content-trust
* v2
* Fix linting errors
* Adjust field checked for status in CAS response
* CI workflow needs CAS not VCN now
* Use cwd in test as code won't be in /usr/src
* Pre-cache CAS pub key for supervisor
* Cas doesn't actually need key file executable
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
Hassio supervisor saves backups in tar files that contains compressed
tar archives, this is convenient when such backups are kept in the same
environment or need to be transferred remotely, but it's not convenient
when they will be processed using other backup tools such as borg or
restic that can handle compression, encryption and data deduplication
themselves.
In fact deduplication won't actually work at all with hassio compressed
backups as there's no way to find common streams for such tools (unless
we make them to export the archives during importing as borg's
import-tar can do), but this would lead to archives that are not easily
recoverable by the supervisor.
So, make possible to pass a "compressed" boolean parameter when creating
backups that will just archive all the data uncompressed.
It will be then up to other tools to manage the archives compression.
Make sure to not reference version attribute from the DockerAddon
instance since it is not yet populated in case this instance hadn't
installed that Add-on previously.
Use the higher level Images.load() API which returns a list of images
instead of loading with the lower level API and then search for the
image we just imported.
* Notify HA Core when backup is being executed
Notify Home Assistant Core using the Websocket API when the Home Assistant
config directory is about to get backed up. This makes sure the Core can
prepare the SQLite database (if active) so it safe to make a backup.
* Only close WebSocket connection on connection errors
Let regular WebSocket errors bubble to the caller so they can be handled
explicitly.
* Add version restriction to backup/start/end WS commands
* Restore Home Assistant metadata when Home Assistant is selected
Currently log files are excluded from the backup. Core uses a time or
startup based log rotation mechanism, both append a dot and an
additional; string (`.1`, `.{timestamp}`). There is also a fault
mechanism which creates a log file with the ending `.log.fault`. Exclude
all cases from the backup.
* De-duplicate Backup/Restore logic
Create internal _do_backup()/_do_restore() method which de-duplicates
some of the backup/restore logic previously part of full/partial backup/restore.
* Add Backup/Restore test coverage
* Avoid accessing properties of udevice.parent
The if statement currently causes access of a property of
udevice.parent, leading to:
tests/hardware/test_module.py: 104 warnings
/workspaces/supervisor/supervisor/hardware/data.py:50: DeprecationWarning: Will be removed in 1.0. Access properties with Device.properties.
Change the if statement to avoid property access and the deprecation
warning.
* Create task before using asyncio.wait()
Avoid deprecation warnings such as:
tests/store/test_custom_repository.py: 5 warnings
/workspaces/supervisor/supervisor/store/__init__.py:113: DeprecationWarning: The explicit passing of coroutine objects to asyncio.wait() is deprecated since Python 3.8, and scheduled for removal in Python 3.11.
await asyncio.wait(tasks)
The documentation says that passing null to `image` allows to clear
the option. Currently `null` is not allowed leading to:
Error: expected string or buffer for dictionary value @ data['image']. Got None
While at it, also update type annotation to reflect what the API
currently allows.
* Fix static assignment of IPv6 addresses
* Support statically assigned link local addresses
Statically assigned link local addresses are perfectly supported in IPv6
use cases.
* Handle empty Add-on backup properly
Check if the data directory exist in the backup. If not, make sure a
directory gets created so the options.json can be written afterwards.
* Remove unrelated change
Sometimes NetworkManager network devices disappear while we are query
them. Presumably those are network interfaces generated by Docker.
Skip them and print a warning.
* Allow to update connection information
* Introduce Signal wrapper class using async context manager
This allows to start monitoring signals and execute code before
processing signals. With that it is possible to check for state changes
in a race free manor.
* Fix unit tests
* Introduce enum for network connectivity
* Differentiate between Bus Name and Interface consts
The Bus names and interfaces look quite similar in D-Bus: Both use dots
to separate words. Usually all interfaces available below a certan Bus
name start with the Bus name. Quite often the Bus name itself is also
available as an interface.
However, those are different things. To avoid confusion, add the type of
const to the const name.
* Remove unused const
* Disconnect D-Bus when not used
Make sure Python disconnects from D-Bus when objects get destroyed. This
avoids exhausting D-Bus connection limit which causes the following
error message:
[system] The maximum number of active connections for UID 0 has been reached (max_connections_per_user=256)
* Filter signals by object as well
Make sure we only listen to signals on that particular object. Also
support filtering messages via message filter callback.
* Explicitly wait until Connection is activated
Wait for activated or raise an error. This avoids too early/errornous
updates when state of the connection changes to "activating" or similar
intermediate signal states.
Fixes: #2639
* Fix VLAN configuration
* Add link to D-Bus object documentation
* Fix network settings update test
* Make MessageBus object optional
* Use the correct interface name to get properties of systemd
It seems that gdbus (or systemd) automatically pick the correct
interface and return the properties. However, dbussy requires the
correct interface name to get all properties.
* Don't expect array from Strength property
The property returns a type "y" which equates to "guchar":
https://developer-old.gnome.org/NetworkManager/stable/gdbus-org.freedesktop.NetworkManager.AccessPoint.html#gdbus-property-org-freedesktop-NetworkManager-AccessPoint.Strength
It seems that the old D-Bus implementation returned an array. With
dbus-next a integer is returned, so no list indexing required.
* Support signals and remove no longer used tests and code
* Pass rauc update file path as string
That is what the interface is expecting, otherwise the new lib chocks on
the Pathlib type.
* Support Network configuration with dbus-next
Assemble Python native objects and pass them to dbus-next. Use dbus-next
specific Variant class where necessary.
* Use org.freedesktop.NetworkManager.Connection.Active.StateChanged
org.freedesktop.NetworkManager.Connection.Active.PropertyChanged is
depricated. Also it seems that StateChanged leads to fewer and more
accurate signals.
* Pass correct data type to RequestScan.
RequestScan expects an option dictionary. Pass an empty option
dictionary to it.
* Update unit tests
Replace gdbus specific fixtures with json files representing the return
values. Those can be easily converted into native Python objects.
* Rename D-Bus utils module gdbus to dbus
Docker reports:
Sep 23 08:16:31 homeassistant dockerd[467]: time="2021-09-23T08:16:31.771717436Z" level=warning msg="Security options with `:` as a separator are deprecated and will be completely unsupported in 17.04, use `=` instead."
Since it seems that Docker supports `=` since quite a while, we should
use `=` only.
* Return list of possible data disk targets
* fix path
* fix tests
* Add test
* Fix tests
* Add tests
* Add more tests
* Remove debug
* Address comments
* more clear
Probably related to https://github.com/home-assistant/plugin-observer/issues/22
Sometimes i notice my supervisor logs shows a random :
WARNING (MainThread) [supervisor.misc.tasks] Watchdog/Application found a problem with observer plugin!
i believe the cause to be related to the timeout being too short on a "busy" system, thus my proposal to relax it to 10 seconds.
Once {os_name} is part of the update URL we also need to set the OS name
explicitly for upgrades: A user might use a new Supervisor version on a
OS release 5 device. The device will still use "hassos" as OS name.
Before introducing {os_name}, the new OS name was part of the URL. Now
when {os_name} is used, we need to adjust the name for upgrade as well.
* Add new time handling
* migrate date for python3.9
* add timedate
* add tests & simplify it
* better testing
* use ssl
* use hostname with new interface
* expose to API
* update data
* add base handler
* new timezone handling
* improve handling
* Improve handling
* Add tests
* Time adjustment function
* Fix logging
* tweak condition
* don't adjust synchronized time
* Guard
* ignore UTC
* small cleanup
* like that, we can leaf it
* add URL
* add comment
* Apply suggestions from code review
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
Co-authored-by: Joakim Sørensen <joasoe@gmail.com>
Introduce commands which are run before and after a snapshot is being
taken. This is useful for e.g. for database add-ons to suspend write
operations during snapshot.
* Add architectures supported by generic-x86-64 board
* Follow intel-nuc to generic-x86-64 rename when updating
Home Assistant OS renamed the intel-nuc board to generic-x86-64. Make
sure to download the generic-x86-64 raucb OS update when updating a
intel-nuc machine.
* Don't explicit use section, rely on AwesomeVersion's comparision
* Remove unecessary global variable TEST_URL
* Fix version comparision
* Remove rate limiter on updater.fetch_data()
* Update tests/test_hassos.py
Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>
* Fix black issue
Co-authored-by: Pascal Vizeli <pascal.vizeli@syshack.ch>