aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robin Obůrka <r.oburka@gmail.com> 2016-04-06 23:02:14 +0200
committerGravatar Robin Obůrka <r.oburka@gmail.com> 2016-04-07 00:54:21 +0200
commit16c2e502eaaecfaae234449ab325bc10c0dcedf2 (patch)
treeefc7189093db2ea528e9e1f014334747cfd032ed
parentProvide some basic functionality (diff)
downloadansible-uci-16c2e502eaaecfaae234449ab325bc10c0dcedf2.tar.xz
Rename parameter config to section
The official structure is package.config.option but uci tool has structure config.section.option. I don't want to confuse people. So I defined structure package.section.option.
-rw-r--r--uci.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/uci.py b/uci.py
index be6c475..d567e49 100644
--- a/uci.py
+++ b/uci.py
@@ -24,9 +24,9 @@ def val_or_none(params, key):
return params[key]
-def get_uci_key(package, config, type, index, name):
- if config:
- return "{}.{}.{}".format(package, config, name)
+def get_uci_key(package, section, type, index, name):
+ if section:
+ return "{}.{}.{}".format(package, section, name)
elif type and index:
return "{}.@{}[{}].{}".format(package, type, index, name)
@@ -87,7 +87,7 @@ def main():
name = dict(aliases=["key"], required=True),
value = dict(aliases=["val"], required=False),
package = dict(aliases=["p"], required=True),
- config = dict(aliases=["c"], required=False),
+ section = dict(aliases=["s"], required=False),
type = dict(required=False),
index = dict(required=False),
item = dict(default="option", choices=["option", "list"]),
@@ -107,7 +107,7 @@ def main():
name = val_or_none(p, "name")
value = val_or_none(p, "value")
package = val_or_none(p, "package")
- config = val_or_none(p, "config")
+ section = val_or_none(p, "section")
type = val_or_none(p, "type")
index = val_or_none(p, "index")
item = val_or_none(p, "item")
@@ -119,7 +119,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, config, type, index, name)
+ key = get_uci_key(package, section, type, index, name)
val = uci_get(module, bin_path, key)
## Handle deletes