aboutsummaryrefslogtreecommitdiffstats
path: root/uci.py
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-04-06 23:32:50 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-04-07 00:54:43 +0200
commit9e4e7493bac24b35b40e3cd9846e3a057cc7c5af (patch)
tree54f72677cc58f509abc9c0300a76cccfc2971362 /uci.py
parentLet get_uci_key() build section key too (diff)
downloadansible-uci-9e4e7493bac24b35b40e3cd9846e3a057cc7c5af.tar.xz
Add switch noreturn to uci_set()
Diffstat (limited to 'uci.py')
-rw-r--r--uci.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/uci.py b/uci.py
index 8574c45..79b1202 100644
--- a/uci.py
+++ b/uci.py
@@ -76,13 +76,14 @@ def uci_get(module, binary, key):
return None
-def uci_set(module, binary, key, value):
+def uci_set(module, binary, key, value, noreturn=False):
status, stdout, stderr = module.run_command("{} set {}='{}'".format(binary, key, value))
if status != 0:
module.fail_json(msg="Command uci failed with: {}".format(stderr))
- uci_commit(module, binary, split_key(key)[0])
- module.exit_json(changed=True)
+ if not noreturn:
+ uci_commit(module, binary, split_key(key)[0])
+ module.exit_json(changed=True)
def main():