diff --git a/src/octoprint/plugins/softwareupdate/__init__.py b/src/octoprint/plugins/softwareupdate/__init__.py index 0e3534622..13e27351f 100644 --- a/src/octoprint/plugins/softwareupdate/__init__.py +++ b/src/octoprint/plugins/softwareupdate/__init__.py @@ -40,7 +40,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, octoprint.plugin.EventHandlerPlugin): COMMIT_TRACKING_TYPES = ("github_commit", "bitbucket_commit") - + DATA_FORMAT_VERSION = "v2" def __init__(self): @@ -85,13 +85,9 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, roles=["check"]), dict(key="UPDATE", name="Update", - description=gettext("Allows to perform a software updates"), - roles=["update"]), - dict(key="ACCESS", - combined=True, - name="Access", - permissions=["PLUGIN_SOFTWAREUPDATE_CHECK", - "PLUGIN_SOFTWAREUPDATE_UPDATE"]) + description=gettext("Allows to perform software updates"), + roles=["update"], + dangerous=True) ] def on_startup(self, host, port): @@ -361,7 +357,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if "octoprint_type" in data: octoprint_type = data["octoprint_type"] - + if octoprint_type == "github_release": self._settings.set(["checks", "octoprint", "type"], octoprint_type, defaults=defaults, force=True) self._settings.set(["checks", "octoprint", "method"], "pip", defaults=defaults, force=True) @@ -382,7 +378,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, self._settings.set(["checks", "octoprint", "prerelease"], False, defaults=defaults, force=True) self._settings.set(["checks", "octoprint", "prerelease_channel"], None, defaults=defaults, force=True) updated_octoprint_check_config = True - + if updated_octoprint_check_config: self._refresh_configured_checks = True try: @@ -399,11 +395,11 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, if current is None or current < 6: # up until & including config version 5 we didn't set the method parameter for the octoprint check # configuration - + configured_checks = self._settings.get(["checks"], incl_defaults=False) if configured_checks is not None and "octoprint" in configured_checks: octoprint_check = dict(configured_checks["octoprint"]) - + if not "method" in octoprint_check and octoprint_check.get("type") == "git_commit": defaults = dict(plugins=dict(softwareupdate=dict(checks=dict(octoprint=dict(method="pip"))))) self._settings.set(["checks", "octoprint", "method"], "update_script", defaults=defaults) @@ -719,7 +715,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, releaseNotes=release_notes, online=target_online, error=target_error) - + if target == "octoprint" and "released_version" in populated_check: information[target]["released_version"] = populated_check["released_version"] @@ -1044,7 +1040,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, # we compare versions fully, not just the base so that we see a difference # between RCs + stable for the same version release result["force_base"] = False - + if check.get("prerelease", None): # we are tracking prereleases => we want to be on the correct prerelease channel/branch channel = check.get("prerelease_channel", None) @@ -1052,7 +1048,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, # if we have a release channel, we also set our update_branch here to our release channel # in case it's not already set result["update_branch"] = check.get("update_branch", channel) - + else: # we are not tracking prereleases, but aren't on the stable branch either => switch back # to stable branch on update @@ -1070,7 +1066,7 @@ class SoftwareUpdatePlugin(octoprint.plugin.BlueprintPlugin, # branch of the release channel - unequality means we might have to handle # a downgrade result["release_compare"] = "python_unequal" - + elif check.get("pip", None): # we force python unequality check for pip installs, to be able to downgrade result["release_compare"] = "python_unequal"