- infos = Information about the blockresolver plugin is in keys below
- infos/author = Thomas Waser thoma.nosp@m.s.wa.nosp@m.ser@l.nosp@m.ibel.nosp@m.ektra.nosp@m..org
- infos/licence = BSD
- infos/needs =
- infos/provides = resolver
- infos/recommends =
- infos/placements = rollback getresolver setresolver commit
- infos/status = maintained conformant compatible coverage specific unittest tested nodep libc configurable preview experimental difficult unfinished concept
- infos/metadata =
- infos/description = resolver for parts in a file configuration file
The blockresolver
can be used to only resolve a tagged block inside a configuration file.
Implementation details
blockresolver
extracts the requested block from the configurations file and writes it into a temporary file. Afterwards Elektra will only work on the temporary file until kdbSet is called. On kdbSet the contents of the temporary file will be merged with parts outside of the requested block from the original file.
Usage
`kdb mount -R blockresolver /path/to/my/file /mountpoint -c identifier="identifier-tag"`
where identifier
specifies the tag blockresolver
will search for in the configuration file.
A block consists of 2 parts:
- beginning: the identifier suffixed with
start
- end: the identifier suffixed with
stop
Limitations
Currently the identifier must be unique.
Example
1 # Backup-and-Restore:system/tests/blockresolver
4 kdb set system/tests/blockfile $(mktemp)
5 echo 'text' > $(kdb get system/tests/blockfile)
6 echo 'more text' >> $(kdb get system/tests/blockfile)
7 echo 'some more text' >> $(kdb get system/tests/blockfile)
8 echo '>>> block config start' >> $(kdb get system/tests/blockfile)
9 echo '[section1]' >> $(kdb get system/tests/blockfile)
10 echo 'key1 = val1' >> $(kdb get system/tests/blockfile)
11 echo '[section2]' >> $(kdb get system/tests/blockfile)
12 echo 'key2 = val2' >> $(kdb get system/tests/blockfile)
13 echo '>>> block config stop' >> $(kdb get system/tests/blockfile)
14 echo 'text again' >> $(kdb get system/tests/blockfile)
15 echo 'and more text' >> $(kdb get system/tests/blockfile)
16 echo 'text' >> $(kdb get system/tests/blockfile)
18 sudo kdb mount -R blockresolver $(kdb get system/tests/blockfile) system/tests/blockresolver -c identifier=">>> block config" ini
21 cat $(kdb get system/tests/blockfile)
25 #> >>> block config start
30 #> >>> block config stop
35 # only the block between the tags is read!
36 kdb export system/tests/blockresolver ini
42 # add a new key to the resolved block
43 kdb set system/tests/blockresolver/section1/key12 val12
45 cat $(kdb get system/tests/blockfile)
49 #> >>> block config start
55 #> >>> block config stop
61 kdb rm -r system/tests/blockresolver
62 rm $(kdb get system/tests/blockfile)
63 kdb rm system/tests/blockfile
64 sudo kdb umount system/tests/blockresolver