4892 Commits

Author SHA1 Message Date
Stefan Agner
77523f7bec
Avoid space in update link of frontend update PR (#5694)
A newline is converted to a space as per YAML folding rules. The space
breaks markdown parsing of the link. Use a single line for the target
version link.
2025-02-28 13:13:11 +01:00
Stefan Agner
f4d69f1811
Make advanced logs error test work in all test environments (#5692)
When developing/testing in a Supervised environment, the
systemd-journal-gatewayd socket is actually available. Mock the
socket Path file to make the test independent of the pytest
environment.
2025-02-28 12:59:20 +01:00
Stefan Agner
cf5a0dc548
Add body with update information to frontend update prs (#5691)
Overwrite the default body with useful version update information and
a link to the new release.

Also rename the title and use lower caps for local shell variables.
2025-02-28 11:57:30 +01:00
dependabot[bot]
a8cc3ae6ef
Bump actions/cache from 4.2.1 to 4.2.2 (#5690)
Bumps [actions/cache](https://github.com/actions/cache) from 4.2.1 to 4.2.2.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4.2.1...v4.2.2)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 10:21:43 +01:00
Stefan Agner
362bd8fd21
Enable Sentry asyncio integration (#5685)
Enable the Sentry asyncio integration. This makes sure that exception
in non-awaited tasks get reported to sentry.

While at it, use partial instead of lambda for the filter function.
2025-02-28 09:57:11 +01:00
Mike Degatano
2274de969f
File open calls to executor (#5678) 2025-02-28 09:56:59 +01:00
dependabot[bot]
dfed251c7a
Bump ruff from 0.9.7 to 0.9.8 (#5689)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.9.7 to 0.9.8.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.9.7...0.9.8)

---
updated-dependencies:
- dependency-name: ruff
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-28 09:33:00 +01:00
Mike Degatano
151d4bdd73
Temporary directory to executor (#5673)
* Move temporary directory usage to executor

* Use temp_folder.name in Path constructor
2025-02-27 17:58:55 +01:00
Stefan Agner
c5d4ebcd48
Correctly handle aiohttp requests in Sentry reporting (#5681)
* Correctly handle aiohttp requests

The request header seems to be a dictionary in current Sentry SDK.
The previous code actually failed with an exception when trying to
unpack the header. However, it seems that Exceptions are not handled
or printed in this filter function, so those issues were simply
swallowed.

The new code has been tested to correctly sanitize and report issues
during aiohttp requests.

* Fix pytests
2025-02-27 15:54:51 +01:00
Stefan Agner
0ad559adcd
Add more context to Sentry reports early during startup (#5682)
* Initialize machine information before Sentry

* Set user and machine for all reports

Now that we initialize machine earlier we can report user and machine
for all events, even before Supervisor is completely initialized.

Also use the new tag format which is a dictionary.

Note that it seems that with the current Sentry SDK version the
AioHttpIntegration no longer sets the URL as a tag. So sanitation is
no longer reuqired.

* Update pytests
2025-02-27 15:45:11 +01:00
Stefan Agner
39f5b91f12
Use await for all FileConfiguration calls (#5683)
Some calls got missed in PR #5652. Update all calls to await the
save_data() coroutine.
2025-02-27 15:38:57 +01:00
dependabot[bot]
ddee79d209
Bump codecov/codecov-action from 5.3.1 to 5.4.0 (#5680)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 5.3.1 to 5.4.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v5.3.1...v5.4.0)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-27 09:04:24 +01:00
dependabot[bot]
ff111253d5
Bump setuptools from 75.8.1 to 75.8.2 (#5679)
Bumps [setuptools](https://github.com/pypa/setuptools) from 75.8.1 to 75.8.2.
- [Release notes](https://github.com/pypa/setuptools/releases)
- [Changelog](https://github.com/pypa/setuptools/blob/main/NEWS.rst)
- [Commits](https://github.com/pypa/setuptools/compare/v75.8.1...v75.8.2)

---
updated-dependencies:
- dependency-name: setuptools
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-27 09:04:03 +01:00
Mike Degatano
31193abb7b
FileConfiguration uses executor for I/O (#5652)
* FileConfiguration uses executor for I/O

* Fix credentials tests

* Remove migrate_system_env as its very deprecated
2025-02-26 19:11:11 +01:00
Stefan Agner
ae266e1692
Improve Supervisor restart detection message (#5672)
The word "reboot" is usually used when a operating system is restarted.
The current log message could be interpreted that the Supervisor
detected an operating system reboot.

Use restart to make it clear that the Supervisor detected a restart of
itself.
2025-02-26 13:10:40 -05:00
dependabot[bot]
c315a15816
Bump securetar from 2025.2.0 to 2025.2.1 (#5671)
* Bump securetar from 2025.2.0 to 2025.2.1

Bumps [securetar](https://github.com/pvizeli/securetar) from 2025.2.0 to 2025.2.1.
- [Release notes](https://github.com/pvizeli/securetar/releases)
- [Commits](https://github.com/pvizeli/securetar/compare/2025.2.0...2025.2.1)

---
updated-dependencies:
- dependency-name: securetar
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Handle new AddFileError where atomic_contents_add is used

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stefan Agner <stefan@agner.ch>
2025-02-26 09:30:22 -05:00
dependabot[bot]
3bd732147c
Bump actions/download-artifact from 4.1.8 to 4.1.9 (#5675)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-26 08:51:39 +01:00
dependabot[bot]
ddbde93a6d
Bump setuptools from 75.8.0 to 75.8.1 (#5676)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-26 08:51:16 +01:00
dependabot[bot]
6db11a8ade
Bump home-assistant/builder from 2024.08.2 to 2025.02.0 (#5674)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-26 08:46:38 +01:00
Stefan Agner
42e78408a7
Fix add-on store reset (#5669)
Make sure that add-on store resets do not delete the root folder. This
is important so that successive reset attempts do not fail (the
directory passed to `remove_folder` must exist, otherwise find fails
with an non-zero exit code).

While at it, handle find errors properly and report errors as critical.
2025.02.4
2025-02-25 17:11:34 +01:00
Stefan Agner
15e8940c7f
Improve D-Bus timeout error handling (#5664)
* Improve D-Bus timeout error handling

Typically D-Bus timeouts are related to systemd activation timing out
after 25s. The current dbus-fast timeout of 10s is well below that
so we never get the actual D-Bus error. This increases the dbus-fast
timeout to 30s, which will make sure we wait long enought to get the
actual D-Bus error from the broker.

Note that this should not slow down a typical system, since we tried
three times each waiting for 10s. With the new error handling typically
we'll end up waiting 25s and then receive the actual D-Bus error. There
is no point in waiting for multiple D-Bus/systemd caused timeouts.

* Create D-Bus TimedOut exception
2025-02-25 17:11:23 +01:00
dependabot[bot]
644ec45ded
Bump aiohttp from 3.11.12 to 3.11.13 (#5665)
---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-25 12:02:45 +01:00
Stefan Agner
a8d2743f56
Define CPU architecture to fix armhf builds (#5670) 2025-02-25 11:36:35 +01:00
dependabot[bot]
0acef4a6e6
Bump dbus-fast from 2.33.0 to 2.34.0 (#5666)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-25 09:15:24 +01:00
Stefan Agner
5733db94aa
Revert "Fix add-on store reset"
This reverts commit da8c6cf1117e1b3d9522a293912376f5d455b389.
2025-02-25 09:10:27 +01:00
Stefan Agner
da8c6cf111
Fix add-on store reset
Make sure that add-on store resets do not delete the root folder. This
is important so that successive reset attempts do not fail (the
directory passed to `remove_folder` must exist, otherwise find fails
with an non-zero exit code).

While at it, handle find errors properly and report errors as critical.
2025-02-25 09:02:09 +01:00
Stefan Agner
802ee25a8b
Build Python wheels for Python 3.13 (#5667) 2025-02-25 08:48:07 +01:00
Stefan Agner
ce8b107f1e
Handle OS errors on backup create (#5662)
* Handle permission error on backup create

Make sure we handle (write) permission errors when creating a backup.

* Introduce BackupFileExistError and BackupPermissionError exceptions

* Make error messages a bit more uniform

* Drop use of exclusive mode

SecureTar does not handle exclusive mode nicely. Drop use of it for now.
2025-02-24 21:34:23 +01:00
Stefan Agner
32936e5de0
Handle non-zero subprocess exits (#5660)
With PR #5634 (which had the goal to remove I/O in event loop for backup
operations) the semantics of `remove_folder` changed slightly: Non-zero
exits of subprocesses were no longer handled, but lead to a
CalledProcessError.

Now to restore the semantics of `remove_folder` we should simply log an
error. However, this semantic change actually uncovered a potential
problem in deployed systems: There are 34 users on beta channel which
regularly seem to run `FixupStoreExecuteReset`, and with the semantic
change we see those errors in Sentry.

An obvious problem could be no storage. But in a quick test that would
not execute the repair in first place since the fixup has the job
condition `FREE_SPACE` set. So the problem is likely elsewhere.

With this change, we log the stderr of find, while still raising the
exception. With that we should get more context in Sentry to see what
could be the underlying error.
2025.02.3
2025-02-24 12:30:39 +01:00
dependabot[bot]
c35746c3e1
Bump actions/upload-artifact from 4.6.0 to 4.6.1 (#5659) 2025-02-24 08:33:31 +01:00
dependabot[bot]
392dd9f904
Bump zlib-fast from 0.2.0 to 0.2.1 (#5658) 2025-02-24 08:31:37 +01:00
github-actions[bot]
d8f792950b
Autoupdate frontend to version 20250221.0 (#5616)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-02-22 21:44:20 +01:00
dependabot[bot]
1f6cdc3018
Bump sigstore/cosign-installer from 3.8.0 to 3.8.1 (#5654)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-21 19:36:11 +01:00
dependabot[bot]
616f1903b7
Bump ruff from 0.9.6 to 0.9.7 (#5653) 2025-02-21 14:50:51 +01:00
Stefan Agner
997a51fc42
Remove I/O in event loop for add-on backup and restore (#5649)
* Remove I/O in event loop for add-on backup and restore

Remove I/O in event loop for add-on backup and restore operations. On
backup, this moves the add-on shutdown before metadata is stored in the
backup, which slightly lenghens the time the add-on is actually stopped.

However, the biggest contributor here is likely adding the image
itself if it is a local backup. However, since that is the minority of
cases, I've opted for simplicity over optimizing for this case.

* Use partial to explicitly bind arguments
2025.02.2
2025-02-21 00:24:36 +01:00
dependabot[bot]
cda6325be4
Bump actions/cache from 4.2.0 to 4.2.1 (#5650) 2025-02-20 09:07:48 +01:00
Stefan Agner
c8cc6fe003
Remove I/O in event loop for Home Assistant Core backup (#5648)
* Remove I/O in event loop for Home Assistant Core backup

The Home Assistant Core backup still contains some I/O in the event
loop. Move all I/O into the executor.

* Update supervisor/homeassistant/module.py

Co-authored-by: Mike Degatano <michael.degatano@gmail.com>

---------

Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
2025-02-19 20:11:37 +01:00
Stefan Agner
34939cfe52
Remove I/O in event loop for backup load, import and remove (#5647)
* Avoid IO in event loop when removing backup

* Refactor backup size calculation

Currently size is lazy loaded when required via properties. This
however is blocking the async event loop.

Backup sizes don't change. Instead of lazy loading the size of a backup
simply determine it on loading/after creation.

* Fix tests for backup size change

* Avoid IO in event loop when loading backups

* Avoid IO in event loop when importing a backup
2025-02-19 16:00:17 +01:00
Stefan Agner
37bc703bbb
Disable uv cache when creating container image (#5646)
We don't intent to run uv again, so the cache is not really useful.
The cache directory size is around 80MB, however, the files are mostly
hardlinks to the original files in `/usr/local/lib/python3.13/site-packages`
so the actual saving is much smaller.
2025-02-19 10:45:22 +01:00
Stefan Agner
5f8e41b441
Capture errors correctly while copying backups (#5644)
Make sure we correctly capture errors while copying backups by using
the current job instance.
2025-02-19 09:12:36 +01:00
Stefan Agner
606db3585c
Remove I/O in event loop for backup create and restore operations (#5634)
* Remove I/O from backup create() function

* Move mount check into exectutor thread

* Remove I/O from backup open() function

* Remove I/O from _folder_save()

* Refactor remove_folder and remove_folder_with_excludes

Make remove_folder and remove_folder_with_excludes synchronous
functions which need to be run in an executor thread to be safely used
in asyncio. This makes them better composable with other I/O operations
like checking for file existence etc.

* Fix logger typo

* Use return values for functions running in an exectutor

* Move location check into a separate function

* Fix extract
2025-02-18 20:59:09 +01:00
Robert Resch
4054749eb2
Use uv to install supervisor (#5642) 2025-02-18 14:54:23 -05:00
Robert Resch
ad5827d33f
Bump uv to 0.6.1 (#5641)
* Bump uv to 0.6.0

* Bump uv to 0.6.1
2025-02-18 19:26:36 +01:00
Jan Čermák
249464e928
Generate Python bytecode for site-packages during build (#5640)
Since transition from pip to uv in #5152, Supervisor container doesn't
contain bytecode for site-packages anymore, and because our AppArmor
profile denies mkdir operations, the compiled *.pyc files are never
created. Enable uv --compile option to opt for the same behavior as pip
had, to fix of the AA errors and the potential penalty of compilation on
every import.
2025-02-18 18:44:37 +01:00
dependabot[bot]
3bc55c054a
Bump sentry-sdk from 2.21.0 to 2.22.0 (#5638)
Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 2.21.0 to 2.22.0.
- [Release notes](https://github.com/getsentry/sentry-python/releases)
- [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-python/compare/2.21.0...2.22.0)

---
updated-dependencies:
- dependency-name: sentry-sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-18 12:28:17 +01:00
Stefan Agner
4c108eea64
Always validate Backup before restoring (#5632)
* Validate Backup always before restoring

Since #5519 we check the encryption password early in restore case.
This has the side effect that we check the file existance early too.
However, in the non-encryption case, the file is not checked early.

This PR changes the behavior to always validate the backup file before
restoring, ensuring both encryption and non-encryption cases are
handled consistently.

In particular, the last case of test_restore_immediate_errors actually
validates that behavior. That test should actually have failed so far.
But it seems that because we validate the backup shortly after freeze
anyways, the exception still got raised early enough.

A simply `await asyncio.sleep(10)` right after the freeze makes the
test case fail. With this change, the test works consistently.

* Address pylint

* Fix backup_manager tests

* Drop warning message
2025-02-14 18:19:35 +01:00
Stefan Agner
9b2dbd634d
Avoid exception when handling closed WebSocket connection (#5630)
When delivering multiple messages to Core, and the first fails with a
connection error, the second message will also fail with the same error.
But at this point the connection is already clsoed, which leads to an
exception in the exception handler. Avoid this compunding error by
checking if the connection is still exists before trying to close.

Fixes: #5629
2025-02-14 13:12:56 +01:00
dependabot[bot]
2cb2a48184
Bump securetar from 2025.1.4 to 2025.2.0 (#5628)
Bumps [securetar](https://github.com/pvizeli/securetar) from 2025.1.4 to 2025.2.0.
- [Release notes](https://github.com/pvizeli/securetar/releases)
- [Commits](https://github.com/pvizeli/securetar/compare/2025.1.4...2025.2.0)

---
updated-dependencies:
- dependency-name: securetar
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-14 11:05:21 +01:00
dependabot[bot]
ed5a0b511e
Bump sentry-sdk from 2.20.0 to 2.21.0 (#5625)
Bumps [sentry-sdk](https://github.com/getsentry/sentry-python) from 2.20.0 to 2.21.0.
- [Release notes](https://github.com/getsentry/sentry-python/releases)
- [Changelog](https://github.com/getsentry/sentry-python/blob/master/CHANGELOG.md)
- [Commits](https://github.com/getsentry/sentry-python/compare/2.20.0...2.21.0)

---
updated-dependencies:
- dependency-name: sentry-sdk
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-13 10:32:49 +01:00
dependabot[bot]
1475dcb50b
Bump cryptography from 44.0.0 to 44.0.1 (#5621)
Bumps [cryptography](https://github.com/pyca/cryptography) from 44.0.0 to 44.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/44.0.0...44.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2025-02-12 13:43:01 +01:00