mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-25 18:16:32 +00:00
Fix autoupdate time compare (#4897)
* Fix autoupdate time compare Make sure both timestamps are UTC, otherwise Python complains with: TypeError: can't compare offset-naive and offset-aware datetimes * Use correect attribute --------- Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
parent
52e0c7e484
commit
a71111b378
@ -22,6 +22,8 @@ from securetar import atomic_contents_add, secure_path
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
from voluptuous.humanize import humanize_error
|
from voluptuous.humanize import humanize_error
|
||||||
|
|
||||||
|
from supervisor.utils.dt import utc_from_timestamp
|
||||||
|
|
||||||
from ..bus import EventListener
|
from ..bus import EventListener
|
||||||
from ..const import (
|
from ..const import (
|
||||||
ATTR_ACCESS_TOKEN,
|
ATTR_ACCESS_TOKEN,
|
||||||
@ -349,7 +351,7 @@ class Addon(AddonModel):
|
|||||||
@property
|
@property
|
||||||
def latest_version_timestamp(self) -> datetime:
|
def latest_version_timestamp(self) -> datetime:
|
||||||
"""Return when latest version was first seen."""
|
"""Return when latest version was first seen."""
|
||||||
return datetime.fromtimestamp(self.data_store[ATTR_VERSION_TIMESTAMP])
|
return utc_from_timestamp(self.data_store[ATTR_VERSION_TIMESTAMP])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def protected(self) -> bool:
|
def protected(self) -> bool:
|
||||||
|
@ -10,6 +10,8 @@ from typing import Any
|
|||||||
|
|
||||||
from awesomeversion import AwesomeVersion, AwesomeVersionException
|
from awesomeversion import AwesomeVersion, AwesomeVersionException
|
||||||
|
|
||||||
|
from supervisor.utils.dt import utc_from_timestamp
|
||||||
|
|
||||||
from ..const import (
|
from ..const import (
|
||||||
ATTR_ADVANCED,
|
ATTR_ADVANCED,
|
||||||
ATTR_APPARMOR,
|
ATTR_APPARMOR,
|
||||||
@ -227,7 +229,7 @@ class AddonModel(JobGroup, ABC):
|
|||||||
@property
|
@property
|
||||||
def latest_version_timestamp(self) -> datetime:
|
def latest_version_timestamp(self) -> datetime:
|
||||||
"""Return when latest version was first seen."""
|
"""Return when latest version was first seen."""
|
||||||
return datetime.fromtimestamp(self.data[ATTR_VERSION_TIMESTAMP])
|
return utc_from_timestamp(self.data[ATTR_VERSION_TIMESTAMP])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def version(self) -> AwesomeVersion:
|
def version(self) -> AwesomeVersion:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user