mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
- Fixed rpcd broken revert (the problem is that rpcd did not call uci_unload on package before returning. This caused all other methods to fail afterwards because uci_load would fail on an already loaded package)
This commit is contained in:
parent
34710c6308
commit
6c1af5fe07
4 changed files with 38 additions and 8 deletions
|
|
@ -405,10 +405,10 @@
|
|||
if(self[x].constructor == UCI.Section) to_delete[x] = self[x];
|
||||
});
|
||||
//console.log("To delete: "+Object.keys(to_delete));
|
||||
/*$rpc.uci.rollback({
|
||||
config: self[".name"],
|
||||
ubus_rpc_session: $rpc.$sid()
|
||||
}).done(function(){*/
|
||||
$rpc.uci.revert({
|
||||
config: self[".name"]//,
|
||||
//ubus_rpc_session: $rpc.$sid()
|
||||
}).done(function(){
|
||||
$rpc.uci.state({
|
||||
config: self[".name"]
|
||||
}).done(function(data){
|
||||
|
|
@ -433,9 +433,9 @@
|
|||
}).fail(function(){
|
||||
deferred.reject();
|
||||
});
|
||||
/*}).fail(function(){
|
||||
}).fail(function(){
|
||||
deferred.reject("Could not revert config before sync!");
|
||||
}); */
|
||||
});
|
||||
return deferred.promise();
|
||||
}
|
||||
// set object values on objects that match search criteria
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
<switch id="enabled" name="enabled" ng-model="settings.power_led.value" class="green"></switch>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Power-LED Brightness'|translate}}">
|
||||
<luci-slider ng-model="settings.power_led_br.value"></luci-slider>
|
||||
<switch id="enabled" name="enabled" ng-model="settings.power_led_br.value" class="green"></switch>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
|
|
|
|||
|
|
@ -141,7 +141,8 @@
|
|||
"dropbear",
|
||||
"easybox",
|
||||
"hosts",
|
||||
"voice_client"
|
||||
"voice_client",
|
||||
"juci"
|
||||
]
|
||||
},
|
||||
"write": {
|
||||
|
|
|
|||
|
|
@ -1161,7 +1161,35 @@ rpc_uci_revert(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg)
|
||||
{
|
||||
return rpc_uci_revert_commit(ctx, msg, false);
|
||||
struct blob_attr *tb[__RPC_C_MAX];
|
||||
//struct uci_package *p = NULL;
|
||||
struct uci_ptr ptr = { 0 };
|
||||
|
||||
blobmsg_parse(rpc_uci_config_policy, __RPC_C_MAX, tb,
|
||||
blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[RPC_C_CONFIG])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
if (!rpc_uci_write_access(tb[RPC_C_SESSION], tb[RPC_C_CONFIG]))
|
||||
return UBUS_STATUS_PERMISSION_DENIED;
|
||||
|
||||
char *package = blobmsg_data(tb[RPC_C_CONFIG]);
|
||||
int ret = UCI_OK;
|
||||
|
||||
if (uci_lookup_ptr(cursor, &ptr, package, true) == UCI_OK){
|
||||
//printf("Reverting %s\n", ptr.package);
|
||||
ret = uci_revert(cursor, &ptr);
|
||||
if(ptr.p) uci_unload(cursor, ptr.p);
|
||||
}
|
||||
|
||||
blob_buf_init(&buf, 0);
|
||||
|
||||
blobmsg_add_u32(&buf, "code", ret);
|
||||
|
||||
ubus_send_reply(ctx, req, buf.head);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue