[augeas-devel] How to create a new tree node with more than one subnode (key)?
Joe Nuts
joenuts at gmail.com
Mon Mar 7 14:29:32 UTC 2016
I'm having trouble building a lens that creates branches with multiple keys
inside. My configuration file has unique lines which dictate which tree and
branch a value is to be associated with, but the lens configuration I've
build insists on building a sequence where one is not desired.
I've seen where a single line in a configuration file can be built to
create multiple keys in a branch.
test_logrotate.aug shows single line "create 0664 root utmp" converted to
{.../create/mode = 0664
.../create/owner = root
.../create/group = utmp
}
Is this same result possible if the configuration file contains the values
across multiple lines ( sometimes seperated by other configuration values )?
I've built the following lens and test as an example to show my (currently
unachieved ) desired results.
-- simpletestconf.aug --
module Simpletestconf =
autoload xfm
let attribute = [ key /key[1-3]/i . Sep.space . store /value[1-3]/i
]
let testbranch =
[ key /testbranch/i . Sep.space . attribute . Util.eol ]
let lns = ( Util.comment | testbranch ) *
let filter = incl "/etc/simpletest.conf"
let xfm = transform lns filter
-- dist/tests/test_simpletestconf.aug --
module Test_simpletestconf =
let example = "testbranch key1 value1
testbranch key2 value2
testbranch key3 value3
"
test SimpletestConf.lns get example =
{ "testbranch"
{ "key1" = "value1" }
{ "key2" = "value2" }
{ "key3" = "value3" }
}
Running augparse tests/test_simpletestconf.aug gives :
Test failure:tests/test_simpletestconf.aug:9.0-14.1:
Expected:
{
{ "testbranch"
{ "key1" = "value1" }
{ "key2" = "value2" }
{ "key3" = "value3" }
}
}
Actual:
{
{ "testbranch"
{ "key1" = "value1" }
}
{ "testbranch"
{ "key2" = "value2" }
}
{ "testbranch"
{ "key3" = "value3" }
}
}
Syntax error in lens definition
Failed to load tests/test_simpletestconf.aug
Am I overlooking something really simple, or am what I'm attempting not
possible?
Sincerely
-Joe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20160307/55564d8b/attachment.htm>
More information about the augeas-devel
mailing list