How can I get augtool (augeas) or a similarly common tool to work with freetds.conf, so I can automate some configuration in a bash install script?

This doesn't seem to work:

augtool print "/files/etc/freetds/freetds.conf"

However, this works (but it uses the inifile lens for some reason, instead of the odbc lens):

augtool print "/files/etc/odbcinst.ini"

What I have tried:

I also followed these instructions to try to associate the odbc lens to freetds.conf:

$ augtool --noload
augtool> set /augeas/load/odbc/lens odbc.lns
augtool> set /augeas/load/odbc/incl /etc/freetds/freetds.conf
augtool> load
augtool> print /files/etc/freetds/freetds.conf

I tried the same with inifile and IniFile in various combinations, but load failed with error: Lens not found Can not find lens IniFile.lns or Can not find lens inifile.lns.

Other Info:

Errors: There doesn't seem to be any errors mentioning freetds or odbc:

$ augtool print "/augeas//error" | grep freetds
$ augtool print "/augeas//error" | grep -i 'freetds\|odbc'

Versions: I am on Ubuntu 14.04. augtool --version shows augtool 1.2.0

The freetds.conf contents:

You can see my freetds.conf at http://pastebin.com/Lt6GiXAJ

It is the default freetds.conf, except that I added the following lines in the [global] section:

    tds version = 8.0
    client charset = UTF-8
  • Does print /augeas//error say something about these files? – ℝaphink Jan 22 '15 at 8:04
  • Thanks, it found an error in odbcinst.ini, which is read properly after I fixed it. But no errors about freetds.conf. I will update my question with this and some more info. @ℝaphink – Oleg Jan 22 '15 at 18:33

Entries like "tds version" and "client charset" are not supported by the ODBC lens since they contain spaces. As you have seen, you can't use IniFile.lns, since this only contains primitives. But you may look for another Ini-based lens. The following would be a good start point:

grep IniFile /usr/share/augeas/lenses/dist/* | grep --perl-regexp "\blet\s+entry\b"

That is, you should search for a lens that redefines "entry" to allow spaces. It seems that the rsyncd lens does this, so you may try:

augtool --noautoload --transform "rsyncd.lns incl /etc/freetds/freetds.conf" print /files/etc/freetds/freetds.conf
| improve this answer | |

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.