Hi!
I using Augeas to handle dump and passno for certain mount points in /etc/fstab. Each mount point is defined as it's own augeas block:
augeas { 'homeLV':
context => '/files/etc/fstab',
changes => [
'set *[file = "/home"]/dump 0',
'set *[file = "/home"]/passno 0',
],
onlyif => 'match *[file = "/home"] size > 0',
}
augeas { 'optLV':
context => '/files/etc/fstab',
changes => [
'set *[file = "/opt"]/dump 0',
'set *[file = "/opt"]/passno 0',
],
onlyif => 'match *[file = "/opt"] size > 0',
}
This code is taking a very long to to process, about 10 seconds for six mount points. When running a debug run, I can see that /etc/fstab is opened for each augeas code block, also when no change is needed.
debug: Augeas[varLV](provider=augeas): Opening augeas with root /home, lens path , flags 0
debug: Augeas[varLV](provider=augeas): Augeas version 0.10.0 is installed
debug: Augeas[varLV](provider=augeas): Will attempt to save and only run if files changed
debug: Augeas[varLV](provider=augeas): sending command 'set' with params ["/files/etc/fstab/*[file = \"/home\"]/dump", "0"]
debug: Augeas[varLV](provider=augeas): sending command 'set' with params ["/files/etc/fstab/*[file = \"/home\"]/passno", "0"]
debug: Augeas[varLV](provider=augeas): Skipping because no files were changed
debug: Augeas[varLV](provider=augeas): Closed the augeas connection
debug: Augeas[srvLV](provider=augeas): Opening augeas with root /opt, lens path , flags 0
debug: Augeas[srvLV](provider=augeas): Augeas version 0.10.0 is installed
debug: Augeas[srvLV](provider=augeas): Will attempt to save and only run if files changed
debug: Augeas[srvLV](provider=augeas): sending command 'set' with params ["/files/etc/fstab/*[file = \"/opt\"]/dump", "0"]
debug: Augeas[srvLV](provider=augeas): sending command 'set' with params ["/files/etc/fstab/*[file = \"/opt\"]/passno", "0"]
debug: Augeas[srvLV](provider=augeas): Skipping because no files were changed
debug: Augeas[srvLV](provider=augeas): Closed the augeas connection
Are there any obvious ways to speed this up? For example better checking before the code is executed? Putting all the mount point changes in one augeas block would probably speed things up a bit, but then I would not be able to use the onlyif-statement per mount point?
Regards,
Alexander