aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--uci.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/uci.py b/uci.py
index d567e49..8574c45 100644
--- a/uci.py
+++ b/uci.py
@@ -26,10 +26,14 @@ def val_or_none(params, key):
def get_uci_key(package, section, type, index, name):
if section:
- return "{}.{}.{}".format(package, section, name)
+ key = "{}.{}.{}".format(package, section, name)
+ skey = "{}.{}".format(package, section)
+ return key, skey
elif type and index:
- return "{}.@{}[{}].{}".format(package, type, index, name)
+ key = "{}.@{}[{}].{}".format(package, type, index, name)
+ skey = "{}.@{}[{}]".format(package, type, index)
+ return key, skey
else:
module.fail_json(msg="Definition of the key is ambiguous.")
@@ -119,7 +123,7 @@ def main():
module.fail_json(msg="Item of type 'list' is unimplemented for now")
## Get key and value - I need to make decisions
- key = get_uci_key(package, section, type, index, name)
+ key, skey = get_uci_key(package, section, type, index, name)
val = uci_get(module, bin_path, key)
## Handle deletes