diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2019-02-25 15:22:29 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2019-02-25 15:23:33 +0200 |
commit | 14c45b3657700d286cbe857c1add576fa3ddee5a (patch) | |
tree | 6a73174782b8327390feb4322fde5cc0007e092b /aconf/persistence/backends/augeas.lua | |
parent | 8496b9ba7f240f505b23ffcb220efdafa8fad8c7 (diff) | |
download | aconf-14c45b3657700d286cbe857c1add576fa3ddee5a.tar.bz2 aconf-14c45b3657700d286cbe857c1add576fa3ddee5a.tar.xz |
augeas back-end: fix ordering of sequence nodes
Diffstat (limited to 'aconf/persistence/backends/augeas.lua')
-rw-r--r-- | aconf/persistence/backends/augeas.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/aconf/persistence/backends/augeas.lua b/aconf/persistence/backends/augeas.lua index eb954e8..b3bcd2c 100644 --- a/aconf/persistence/backends/augeas.lua +++ b/aconf/persistence/backends/augeas.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2012-2015 Kaarle Ritvanen +Copyright (c) 2012-2019 Kaarle Ritvanen See LICENSE file for license details --]] @@ -236,10 +236,16 @@ function backend:set(mods) local ord = order(path) for _, sibling in ipairs(matches) do - local sord = order(array_join(parent, basename(sibling))) - if sord and sord > ord then - self.aug:insert(sibling, name, true) - return apath, keys + local sname = basename(sibling) + local sord = order(array_join(parent, sname)) + if sord then + local snum = tonumber(sname) + if sord > ord or ( + sord == ord and snum and type(name) == 'number' and snum > name + ) then + self.aug:insert(sibling, name, true) + return apath, keys + end end end end |