I have a MySQL configuration file with an !includedir directive. The directive seems to show up properly when the lens examines the file:

$ sudo augtool print /files/etc/my.cnf | fgrep includedir
/files/etc/my.cnf/!includedir = "/etc/mysql/conf.d/"

However, while augtool prints out the path when examining /etc/my.cnf, it keeps complaining about an invalid path expression if I try to print or examine the actual node. For example:

$ sudo augtool
augtool> print /files/etc/my.cnf/!includedir
error: Invalid path expression
error: empty name

How can I use Augeas 1.0.0 to manage the !includedir directive in the /etc/my.cnf file?


! cannot be used in paths. You can however use the label() function to select that node:

augtool> print /files/etc/mysql/my.cnf/*[label()="!includedir"]
/files/etc/mysql/my.cnf/!includedir = "/etc/mysql/conf.d/"

Path expressions are documented on the Augeas wiki.

  • There appears no reason that ! cannot be in a path, at least none that I can see in the documentation you linked to – Otheus Sep 8 '20 at 14:29

This is a common problem, mysql uses .ini like config files, and every tool tries to handle it like that.. I don't found normal solution for that, but you can always fork / rewrite the current .ini parsing method. And that's not a really good thing.

At the end I solved this by my site like you can have 2 my.cnf files simultaneously /etc/my.cnf and ~/.my.cnf I tried to move my client bindings to these two files. (ok, when they are server config options, I don't have any idea what to do, expect hackety-hack.) :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.