diff --git a/.versioneer-lookup b/.versioneer-lookup index 5965be329..4f9567d7b 100644 --- a/.versioneer-lookup +++ b/.versioneer-lookup @@ -26,8 +26,8 @@ improve/.* 1.10.0 cd955e9a46782119b36cc22b8dea5652ebbf9774 pep440-dev # staging/bugfix is the branch for preparation of the 1.9.x bugfix releases # so are any bug/... branches -staging/bugfix 1.9.2 1d519a21702ea180c026929da2a6e17079470b9a pep440-dev -bug/.* 1.9.2 1d519a21702ea180c026929da2a6e17079470b9a pep440-dev +staging/bugfix 1.9.3 f027aaa7300f70b046525a49245b33c43dd198c1 pep440-dev +bug/.* 1.9.3 f027aaa7300f70b046525a49245b33c43dd198c1 pep440-dev # staging/maintenance is currently the branch for preparation of 1.9.0rc7 # so is regressionfix/... diff --git a/docs/configuration/config_yaml.rst b/docs/configuration/config_yaml.rst index 71bf107cc..a0fcc0c5a 100644 --- a/docs/configuration/config_yaml.rst +++ b/docs/configuration/config_yaml.rst @@ -871,10 +871,6 @@ Use the following settings to configure the server: # reset the setting to false startOnceInSafeMode: false - # Signals to OctoPrint that the last startup was incomplete. OctoPrint will then startup - # in safe mode - incompleteStartup: false - # Set this to true to make OctoPrint ignore incomplete startups. Helpful for development. ignoreIncompleteStartup: false diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index a41fb2a7c..481978592 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -123,7 +123,7 @@ def init_platform( ) settings_incomplete_startup_safemode = ( "incomplete_startup" - if settings.getBoolean(["server", "incompleteStartup"]) + if os.path.exists(os.path.join(settings._basedir, ".incomplete_startup")) and not settings.getBoolean(["server", "ignoreIncompleteStartup"]) else None ) diff --git a/src/octoprint/schema/config/server.py b/src/octoprint/schema/config/server.py index ddc71b272..da28bdd9e 100644 --- a/src/octoprint/schema/config/server.py +++ b/src/octoprint/schema/config/server.py @@ -165,9 +165,6 @@ class ServerConfig(BaseModel): ignoreIncompleteStartup: bool = False """Set this to true to make OctoPrint ignore incomplete startups. Helpful for development.""" - incompleteStartup: bool = False - """Signals to OctoPrint that the last startup was incomplete. OctoPrint will then startup in safe mode.""" - seenWizards: Dict[str, str] = {} secretKey: Optional[str] = None diff --git a/src/octoprint/server/__init__.py b/src/octoprint/server/__init__.py index c2466ad93..28f492e3f 100644 --- a/src/octoprint/server/__init__.py +++ b/src/octoprint/server/__init__.py @@ -9,6 +9,7 @@ import logging import logging.config import mimetypes import os +import pathlib import re import signal import sys @@ -302,9 +303,14 @@ class Server: if self._settings is None: self._settings = settings() + incomplete_startup_flag = ( + pathlib.Path(self._settings._basedir) / ".incomplete_startup" + ) if not self._settings.getBoolean(["server", "ignoreIncompleteStartup"]): - self._settings.setBoolean(["server", "incompleteStartup"], True) - self._settings.save() + try: + incomplete_startup_flag.touch() + except Exception: + self._logger.exception("Could not create startup triggered safemode flag") if self._plugin_manager is None: self._plugin_manager = octoprint.plugin.plugin_manager() @@ -1298,8 +1304,13 @@ class Server: # if there was a rogue plugin we wouldn't even have made it here, so remove startup triggered safe mode # flag again... - self._settings.setBoolean(["server", "incompleteStartup"], False) - self._settings.save() + try: + if incomplete_startup_flag.exists(): + incomplete_startup_flag.unlink() + except Exception: + self._logger.exception( + "Could not clear startup triggered safe mode flag" + ) # make a backup of the current config self._settings.backup(ext="backup")