diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-11-15 20:12:13 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2013-11-15 20:12:13 +0200 |
commit | 28de07b3d60a3fef56b90992bfecb65a81e2114f (patch) | |
tree | 9bc3550cbd108cab8536e327b77b7dbde47ca975 | |
parent | 14ab26132162b248509b9c97457d9f3144960cc0 (diff) | |
download | aconf-28de07b3d60a3fef56b90992bfecb65a81e2114f.tar.bz2 aconf-28de07b3d60a3fef56b90992bfecb65a81e2114f.tar.xz |
augeas backend: fix multi-key selection in set method
-rw-r--r-- | acf2/persistence/backends/augeas.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/acf2/persistence/backends/augeas.lua b/acf2/persistence/backends/augeas.lua index fbe993e..b94a14e 100644 --- a/acf2/persistence/backends/augeas.lua +++ b/acf2/persistence/backends/augeas.lua @@ -191,18 +191,18 @@ function backend:set(mods) if count > 0 and not new then return apath, keys end if key_mode(pmode) then - local cpath = pmode == '@' and append_key_pred( + apath = pmode == '@' and append_key_pred( ppath, '@', '' ) or append_pred(ppath, 'count('..key(pmode)..') = 0') - count = #self.aug:match(cpath) - assert(count < 2) - if count == 0 then cpath = insert(parent, true) end + matches = self.aug:match(apath) + assert(#matches < 2) + apath = matches[1] or insert(parent, true) local key = key(pmode) - self.aug:set(cpath..'/'..key, name) + self.aug:set(apath..'/'..key, name) - return append_key_pred(ppath, pmode, name), keys + return apath, keys end if #matches == 0 then |