cli: use model scope for hook calls
Make the scope consistent with other callbacks Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
bc078b833a
commit
7953376400
@ -151,7 +151,7 @@ function network_sign_data(ctx, name, network, pw_file, upload)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function network_create_uci(name, iface)
|
function network_create_uci(model, name, iface)
|
||||||
{
|
{
|
||||||
let cur = uci.cursor();
|
let cur = uci.cursor();
|
||||||
cur.set("network", name, "interface");
|
cur.set("network", name, "interface");
|
||||||
@ -344,7 +344,7 @@ function network_create(ctx, argv, named) {
|
|||||||
if (!network_sign_data(ctx, named.network, network, pw_file))
|
if (!network_sign_data(ctx, named.network, network, pw_file))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
network_create_uci(named.network, {
|
network_create_uci(ctx.model, named.network, {
|
||||||
proto: "unet",
|
proto: "unet",
|
||||||
metric: named.metric,
|
metric: named.metric,
|
||||||
zone: named.zone,
|
zone: named.zone,
|
||||||
@ -580,7 +580,7 @@ function network_join_peer_update(model, ctx, msg)
|
|||||||
if (joinreq.connect)
|
if (joinreq.connect)
|
||||||
iface.connect = joinreq.connect;
|
iface.connect = joinreq.connect;
|
||||||
|
|
||||||
network_create_uci(name, iface);
|
network_create_uci(model, name, iface);
|
||||||
|
|
||||||
model.status_msg("Configuration added for interface " + name);
|
model.status_msg("Configuration added for interface " + name);
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ function run_hook(name, ...args)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (let hook in hooks)
|
for (let hook in hooks)
|
||||||
call(hook, this, {}, ...args);
|
call(hook, this, this.scope, ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
function init()
|
function init()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user