diff --git a/src/octoprint/plugin/__init__.py b/src/octoprint/plugin/__init__.py index 84fa12b0..0cc58715 100644 --- a/src/octoprint/plugin/__init__.py +++ b/src/octoprint/plugin/__init__.py @@ -446,6 +446,18 @@ class PluginSettings(object): return path def get_all_data(self, **kwargs): + merged = kwargs.get("merged", True) + asdict = kwargs.get("asdict", True) + defaults = kwargs.get("defaults", self.defaults) + preprocessors = kwargs.get("preprocessors", self.get_preprocessors) + + kwargs.update(dict( + merged=merged, + asdict=asdict, + defaults=defaults, + preprocessors=preprocessors + )) + return self.settings.get(self._prefix_path(), **kwargs) def clean_all_data(self): diff --git a/src/octoprint/plugin/types.py b/src/octoprint/plugin/types.py index d2d95491..1b67436b 100644 --- a/src/octoprint/plugin/types.py +++ b/src/octoprint/plugin/types.py @@ -813,12 +813,17 @@ class SettingsPlugin(OctoPrintPlugin): """ import octoprint.util - if self.config_version_key in data: - del data[self.config_version_key] + # get the current data + current = self._settings.get_all_data() + + # merge our new data on top of it + new_current = octoprint.util.dict_merge(current, data) + if self.config_version_key in new_current: + del new_current[self.config_version_key] # determine diff dict that contains minimal set of changes against the # default settings - we only want to persist that, not everything - diff = octoprint.util.dict_diff(self.get_settings_defaults(), data) + diff = octoprint.util.dict_diff(self.get_settings_defaults(), new_current) version = self.get_settings_version()