🐛 backup: fix plugin repo access on cli
We were trying to fetch the repo url from the settings. However, due to the settings overlays from other plugins not being available when operating in a CLI environment, the repository URL was unset and thus nothing was fetched. This is now fixed by falling back to the default repo URL from the pluginmanager, which has been extracted into a constant for that reason. Fixes #3883
This commit is contained in:
1 parent
5825910303
commit
f669c3fb0d
2 files changed
+10
-5
No files matched your search
@@ -49,6 +49,7 @@ import requests
|
||||
import sarge
|
||||
from flask_babel import gettext
|
||||
|
||||
from octoprint.plugins.pluginmanager import DEFAULT_PLUGIN_REPOSITORY
|
||||
from octoprint.settings import valid_boolean_trues
|
||||
from octoprint.util.text import sanitize
|
||||
|
||||
@@ -1118,10 +1119,11 @@ class BackupPlugin(
|
||||
basedir = settings._basedir
|
||||
cls._clean_dir_backup(basedir, on_log_progress=on_log_progress)
|
||||
|
||||
plugin_repo = {}
|
||||
repo_url = settings.global_get(["plugins", "pluginmanager", "repository"])
|
||||
if repo_url:
|
||||
plugin_repo = cls._get_plugin_repository_data(repo_url)
|
||||
if not repo_url:
|
||||
repo_url = DEFAULT_PLUGIN_REPOSITORY
|
||||
|
||||
plugin_repo = cls._get_plugin_repository_data(repo_url)
|
||||
|
||||
if callable(on_restore_start):
|
||||
on_restore_start(path)
|
||||
|
||||
@@ -56,6 +56,9 @@ except ImportError:
|
||||
|
||||
_DATA_FORMAT_VERSION = "v3"
|
||||
|
||||
DEFAULT_PLUGIN_REPOSITORY = "https://plugins.octoprint.org/plugins.json"
|
||||
DEFAULT_PLUGIN_NOTICES = "https://plugins.octoprint.org/notices.json"
|
||||
|
||||
|
||||
def map_repository_entry(entry):
|
||||
if not isinstance(entry, dict):
|
||||
@@ -275,9 +278,9 @@ class PluginManagerPlugin(
|
||||
|
||||
def get_settings_defaults(self):
|
||||
return {
|
||||
"repository": "https://plugins.octoprint.org/plugins.json",
|
||||
"repository": DEFAULT_PLUGIN_REPOSITORY,
|
||||
"repository_ttl": 24 * 60,
|
||||
"notices": "https://plugins.octoprint.org/notices.json",
|
||||
"notices": DEFAULT_PLUGIN_NOTICES,
|
||||
"notices_ttl": 6 * 60,
|
||||
"pip_args": None,
|
||||
"pip_force_user": False,
|
||||
|
||||
Reference in new issue
Block a user