fix(reliability): probe section existence via uci show, not an option key
This commit is contained in:
@@ -4643,13 +4643,17 @@ PINEAPD_RUNTIME_UCI.add('pineapd.@ssidpool[0].disable')
|
||||
|
||||
|
||||
def _apply_uci_wanted(wanted):
|
||||
"""Idempotently apply a wanted UCI key/value set. Returns changed keys."""
|
||||
"""Idempotently apply a wanted UCI key/value set. Returns changed keys.
|
||||
A failed `uci set` (e.g. missing anchor section) is NOT reported as
|
||||
applied."""
|
||||
actions = []
|
||||
for key, value in wanted.items():
|
||||
rc, out, err = device_run(['uci', 'get', key])
|
||||
if rc != 0 or out.strip() != value:
|
||||
device_run(['uci', 'set', '%s=%s' % (key, value)])
|
||||
actions.append(key)
|
||||
src_rc, s_out, s_err = device_run(
|
||||
['uci', 'set', '%s=%s' % (key, value)])
|
||||
if src_rc == 0:
|
||||
actions.append(key)
|
||||
return actions
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user