2

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
/files/etc/my.cnf/|=|!includedir

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

CodeGnome
  • 285
  • 2
  • 9

2 Answers2

1

! 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.

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
raphink
  • 11,337
  • 6
  • 36
  • 47
  • 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 08 '20 at 14:29
0

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.) :(

banyek
  • 379
  • 1
  • 10