From e653a9f3200c82f3eba1f2ddfa3e02a3ab095a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Ob=C5=AFrka?= Date: Thu, 7 Apr 2016 00:29:54 +0200 Subject: Add more logic into uci_set() It handles empty value. --- uci.py | 3 +++ 1 file changed, 3 insertions(+) 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)) -- cgit v1.2.3