urbackup-server-python-web-api-wrapper
urbackup-server-python-web-api-wrapper copied to clipboard
Change client settings
change_client_setting(self, clientname, key, new_value):
When changing settings, the function above is adding incorrect values into the settings of the client/group eg 'exclude_files': { 'use': 1, 'value_group': '' },
It should just update the value, and not add the complete json
See the screenshot of the settings on the front end.
UPDATE:
Changed the function to only send updated values and not all settings. This seems to be working better. Ongoing testing
def change_client_setting(self, clientname, key, new_value):
if not self.login():
return False
client = self.get_client_status(clientname)
if client == None:
return False
clientid = client["id"];
# settings = self._get_json("settings", {"sa": "clientsettings",
# "t_clientid": clientid})
# if not settings or not "settings" in settings:
# return False
settings = {}
settings["settings"] = {}
settings["settings"][key] = new_value
settings["settings"]["overwrite"] = "true"
settings["settings"]["sa"] = "clientsettings_save"
settings["settings"]["t_clientid"] = clientid
ret = self._get_json("settings", settings["settings"])
return ret!=None and "saved_ok" in ret