[augeas-devel] Calling augtool from a script

Graham Leggett minfrin at sharp.fm
Wed Apr 24 12:56:51 UTC 2013


On 24 Apr 2013, at 4:20 AM, Ian Mortimer <i.mortimer at uq.edu.au> wrote:

> Here's a very simple example from a centos kickstart %post:
> 
> augtool -s <<-EOF
> set /files/etc/pam.d/system-auth-ac/*[module = 'pam_mkhomedir.so']/argument[1] umask=0077
> set /files/etc/pam.d/password-auth-ac/*[module = 'pam_mkhomedir.so']/argument[1] umask=0077
> rm /files/etc/ntp.conf/server[. =~ regexp('.*\.centos\.pool\.ntp\.org')]
> EOF

Extending the above, I tried the following:

augtool -s <<-EOF
set /files/etc/fstab/1[file='/home/monica/minfrin']/spec "/dev/vg001/home-monica-minfrin2"
save
print /augeas//error
EOF

What I expected was for the existing line to be updated, and the result saved. What I get instead is this:

+ augtool -s
error: Failed to execute command
error: saving failed (run 'print /augeas//error' for details)
/augeas/files/etc/fstab/error = "put_failed"
/augeas/files/etc/fstab/error/path = "/files/etc/fstab/1"
/augeas/files/etc/fstab/error/lens = "/usr/share/augeas/lenses/dist/fstab.aug:23.17-30.22:"
/augeas/files/etc/fstab/error/message = "Failed to match \n    { /spec/ = /[^\\001-\\004\\t\\n #,][^\\001-\\004\\t\\n ]*/ }{ /file/ = /[^\\001-\\004\\t\\n #,]+/ }{ /vfstype/ = /[^\\001-\\004\\t\\n #,=]+/ }({ /vfstype/ = /[^\\001-\\004\\t\\n #,=]+/ })*{ /opt/ = /[^\\001-\\004\\t\\n #,=]+/ }({ /opt/ = /[^\\001-\\004\\t\\n #,=]+/ })*({ /dump/ = /[0-9]+/ }({ /passno/ = /[0-9]+/ })?)?\n  with tree\n    { \"spec\" = \"/dev/vg001/home-monica-minfrin2\" }"

At this point I am stuck - with no documented working examples I have no working starting point to draw from, these attempts to get augtool to work are all shots in the dark after significant amount of googling. The error that I get is that an entirely incomprehensible regular expression that runs 5 lines doesn't match, and in turn I have no practical hope of figuring out why it doesn't match, or what it means not to match.

Does anyone have a working example that I can start from? Augtool seems like a great idea, it just seems to be virtually impossible to make it work in any practical time frame.

Regards,
Graham
--

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4365 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20130424/fbc80b25/attachment.p7s>


More information about the augeas-devel mailing list