machine: skip validation for new installs

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2024-05-13 20:39:37 -04:00
parent 3f62bb6fb4
commit 6b31076a43
1 changed files with 16 additions and 10 deletions

View File

@ -51,8 +51,8 @@ if TYPE_CHECKING:
from .announcements import Announcements from .announcements import Announcements
from .proc_stats import ProcStats from .proc_stats import ProcStats
from .dbus_manager import DbusManager from .dbus_manager import DbusManager
from dbus_next.aio import ProxyInterface from dbus_next.aio.proxy_object import ProxyInterface
from dbus_next import Variant from dbus_next.signature import Variant
SudoReturn = Union[Awaitable[Tuple[str, bool]], Tuple[str, bool]] SudoReturn = Union[Awaitable[Tuple[str, bool]], Tuple[str, bool]]
SudoCallback = Callable[[], SudoReturn] SudoCallback = Callable[[], SudoReturn]
@ -977,7 +977,7 @@ class BaseProvider:
async def extract_service_info( async def extract_service_info(
self, self,
service: str, service_name: str,
pid: int, pid: int,
properties: Optional[List[str]] = None, properties: Optional[List[str]] = None,
raw: bool = False raw: bool = False
@ -1564,15 +1564,15 @@ class SupervisordCliProvider(BaseProvider):
async def extract_service_info( async def extract_service_info(
self, self,
service: str, service_name: str,
pid: int, pid: int,
properties: Optional[List[str]] = None, properties: Optional[List[str]] = None,
raw: bool = False raw: bool = False
) -> Dict[str, Any]: ) -> Dict[str, Any]:
service_info = await self._find_service_by_pid(service, pid) service_info = await self._find_service_by_pid(service_name, pid)
if not service_info: if not service_info:
logging.info( logging.info(
f"Unable to locate service info for {service}, pid: {pid}" f"Unable to locate service info for {service_name}, pid: {pid}"
) )
return {} return {}
# locate supervisord.conf # locate supervisord.conf
@ -1664,9 +1664,15 @@ class InstallValidator:
async def validation_init(self) -> None: async def validation_init(self) -> None:
db: MoonrakerDatabase = self.server.lookup_component("database") db: MoonrakerDatabase = self.server.lookup_component("database")
install_ver: int = await db.get_item( install_ver: Optional[int] = await db.get_item(
"moonraker", "validate_install.install_version", 0 "moonraker", "validate_install.install_version", None
) )
if install_ver is None:
# skip validation for new installs
await db.insert_item(
"moonraker", "validate_install.install_version", INSTALL_VERSION
)
install_ver = INSTALL_VERSION
if install_ver < INSTALL_VERSION: if install_ver < INSTALL_VERSION:
logging.info("Validation version in database out of date") logging.info("Validation version in database out of date")
self.validation_enabled = True self.validation_enabled = True
@ -1692,8 +1698,8 @@ class InstallValidator:
fm: FileManager = self.server.lookup_component("file_manager") fm: FileManager = self.server.lookup_component("file_manager")
need_restart: bool = False need_restart: bool = False
has_error: bool = False has_error: bool = False
name = "service"
try: try:
name = "service"
need_restart = await self._check_service_file() need_restart = await self._check_service_file()
name = "config" name = "config"
need_restart |= await self._check_configuration() need_restart |= await self._check_configuration()
@ -2144,8 +2150,8 @@ class InstallValidator:
self.announcement_id = "" self.announcement_id = ""
async def _on_password_received(self) -> Tuple[str, bool]: async def _on_password_received(self) -> Tuple[str, bool]:
name = "Service"
try: try:
name = "Service"
await self._check_service_file() await self._check_service_file()
name = "Config" name = "Config"
await self._check_configuration() await self._check_configuration()