aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-04-07 00:29:54 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-04-07 00:54:58 +0200
commite653a9f3200c82f3eba1f2ddfa3e02a3ab095a63 (patch)
tree86f094187afceb8e67886dbd27b09d6783c5487a
parentAdd more logic into get_uci_key() (diff)
downloadansible-uci-e653a9f3200c82f3eba1f2ddfa3e02a3ab095a63.tar.xz
Add more logic into uci_set()
It handles empty value.
-rw-r--r--uci.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/uci.py b/uci.py
index adc8a74..883c17f 100644
--- a/uci.py
+++ b/uci.py
@@ -83,6 +83,9 @@ def uci_get(module, binary, key):
def uci_set(module, binary, key, value, noreturn=False):
+ if not value:
+ module.fail_json(msg="Value wasn't provided")
+
status, stdout, stderr = module.run_command("{} set {}='{}'".format(binary, key, value))
if status != 0:
module.fail_json(msg="Command uci failed with: {}".format(stderr))