paluh / ansible-augeas

Ansible module for augeas
Other
88 stars 17 forks source link

Optimization of costly Augeas() invocation, so it doesn't load all modules #12

Open adamryczkowski opened 8 years ago

adamryczkowski commented 8 years ago

Initially I thought that the performance hit was from the Augeas invocation around the line 443, but further testing proved the problem was in completely different place.

Now the net speed of running the play with a single augeas task on localhost from over 1.2 sec to the 0.3 sec (and that includes all other overheads associated with invocation of ansible).

(The first pull request had a typo, that's why I had to delete it).

adamryczkowski commented 8 years ago

The second commit is a further optimization; it reads the filter parameter for the "incl" string. If found, it prevents augeas from loading built-in modules. This way the behaviour is similar to Puppet's.

Unfortunately, I wasn't able to cleanly infer the filter parameter, if the augeas module is used with the commands parameter; (I am only a beginner with Python). User would have to put it separately, like this:

      augeas: >
        commands='match /files/etc/default/lxc-net/LXC_BRIDGE'
        filter=incl

Please, don't merge this commit yet, I'm still testing this (I'll let you know when I'm ready)