Issue #17522 has been updated by Jo Rhett.

Affected Puppet version changed from 3.0.0 to 3.1.0

Dominic Cleal wrote:
> We'd love to hear about these errors upstream in augeas too!

I did that a few times, and the fact that the application supported the option 
was lost in arguments about retaining augeas purity for a given format. It 
seems like a neat tool, but they appear to have forgotten their original goal. 
Due to these issues and augeas == SLOW I avoid augeas use whenever possible.

> > Wasn't there a performance improvement done for augeas so that it would 
> > stop reading every file the lense could read? Augeas is still the slowest 
> > thing in the puppet run.
> 
> Yes, as long as you specify the `context` parameter.  If you're editing 
> /etc/sysconfig/network for example, set context to 
> `/files/etc/sysconfig/network` and use relative paths in the changes 
> parameter.

I'm using the stock documented sysctl module from the augeas wiki pages. This 
does set context, as shown below, and yet using this produced warnings from 
postfix, apache, dhcp and many other configuration files.

define conf ( $value ) {
    augeas { "sysctl_conf/$name":
    tag     => 'sysctl',
    context => "/files/${sysctl::filename}",
    onlyif  => "get $name != '$value'",
    changes => "set $name '$value'",
    notify  => Exec['reload-sysctl'],
    }
} 

> You can also specify `incl` (the path to the file) and `lens` 
> (`Shellvars.lns` or similar), which does much the same thing.

I'll give that a try.

----------------------------------------
Bug #17522: Augeas load warnings printed when less specific context used
https://projects.puppetlabs.com/issues/17522#change-82866

Author: Dominic Cleal
Status: Merged - Pending Release
Priority: Normal
Assignee: Dominic Cleal
Category: agent
Target version: 3.2.0
Affected Puppet version: 3.1.0
Keywords: augeas warning
Branch: https://github.com/puppetlabs/puppet/pull/1454


open_augeas in the Augeas provider tries to optimise (#14136) if the context is 
given.  It also prints a warning if there are load errors while the 
optimisation's in use (since it should only load files you care about, then 
errors are useful) but otherwise at debug level.

The second part of this if statement shouldn't be setting the "restricted" 
variable to true, only in the inner branch.  I think it ended up on the wrong 
line during merging and caused #15569 at the time.

<pre>
      restricted = false
      if resource[:incl]
        aug.set("/augeas/load/Xfm/lens", resource[:lens])
        aug.set("/augeas/load/Xfm/incl", resource[:incl])
        restricted = true
      elsif glob_avail and opt_ctx
        restricted = true
        # Optimize loading if the context is given, requires the glob function
        # from Augeas 0.8.2 or up
        ctx_path = resource[:context].sub(/^\/files(.*?)\/?$/, '\1/')
        load_path = "/augeas/load/*['%s' !~ glob(incl) + regexp('/.*')]" % 
ctx_path

        if aug.match(load_path).size < aug.match("/augeas/load/*").size
          aug.rm(load_path)
          restricted = true
        else
          # This will occur if the context is less specific than any glob
          debug("Unable to optimize files loaded by context path, no glob 
matches")
        end
      end
</pre>


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to