The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #13259

Augeas error: Could not evaluate: No such file or directory

Added by Tim Bishop about 2 years ago. Updated almost 2 years ago.

Status:DuplicateStart date:03/20/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:augeas
Target version:-
Affected Puppet version:2.7.12 Branch:
Keywords:Augeas FreeBSD

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

I have a problem with Puppet on FreeBSD (I haven’t confirmed if the issue is repeatable on another OS). The relevant software versions are:

  • puppet-2.7.12
  • augeas-0.10.0
  • rubygem-ruby-augeas-0.4.1

My test manifest is:

augeas { '/etc/ssh/sshd_config':
  context => '/files/etc/ssh/sshd_config',
  changes => [
    "set Port 2222",
    "set PermitRootLogin no",
  ],
}

And I apply this as follows, with debugging enabled:

# puppet apply -v -d augtest.pp
...
debug: Augeas[/etc/ssh/sshd_config](provider=augeas): Opening augeas with root /, lens path , flags 0
debug: Augeas[/etc/ssh/sshd_config](provider=augeas): Augeas version 0.10.0 is installed
debug: Augeas[/etc/ssh/sshd_config](provider=augeas): Will attempt to save and only run if files changed
debug: Augeas[/etc/ssh/sshd_config](provider=augeas): sending command 'set' with params ["/files/etc/ssh/sshd_config/Port", "2222"]
debug: Augeas[/etc/ssh/sshd_config](provider=augeas): sending command 'set' with params ["/files/etc/ssh/sshd_config/PermitRootLogin", "no"]
notice: Augeas[/etc/ssh/sshd_config](provider=augeas): saved_file: /etc/ssh/sshd_config
notice: Augeas[/etc/ssh/sshd_config](provider=augeas): saved_file: /etc/ssh/sshd_config
err: /Stage[main]//Augeas[/etc/ssh/sshd_config]: Could not evaluate: No such file or directory - /etc/ssh/sshd_config.augnew
...

There’s two additional lines there. I added the following to the augeas provider:

--- augeas.rb.orig      2012-03-20 20:01:57.000000000 +0000
+++ augeas.rb   2012-03-20 20:02:28.000000000 +0000
@@ -297,10 +297,11 @@
           saved_files = @aug.match("/augeas/events/saved")
           if saved_files.size > 0
             root = resource[:root].sub(/^\/$/, "")
             saved_files.each do |key|
               saved_file = @aug.get(key).sub(/^\/files/, root)
+              notice("saved_file: " + saved_file)
               if Puppet[:show_diff]
                 notice "\n" + diff(saved_file, saved_file + ".augnew")
               end
               File.delete(saved_file + ".augnew")
             end

So the reason for the problem is that Puppet does a diff of the file, removes it, and then attempts to diff it again. The root cause is unknown, but it’s obviously not right that the file appears twice in saved_files.

Issue #13204 offers a fix, but it feels like it’s masking the underlying issue. I’ve tried it, and not surprisingly the fix works.

I’m happy to help debug this where I can.


Related issues

Related to Puppet - Bug #11988: Augeas provider can clobber symlinks Closed 01/17/2012
Related to Puppet - Bug #13204: Augeas save under /boot causes no such file or directory ... Closed 03/18/2012

History

#1 Updated by Tim Bishop about 2 years ago

  • Affected Puppet version deleted (2.7.12rc2)

I’ve done some tests on another FreeBSD machine running Puppet 2.7.10. It has the same versions of augeas and the ruby library.

On that machine it functioned correctly. So it would appear to be a regression between 2.7.10 and 2.7.12.

#2 Updated by Tim Bishop about 2 years ago

Looking at the Changelog for 2.7.12 it seems #11988 touched this code. It’s probably a good starting point for further investigation.

#3 Updated by Tim Bishop about 2 years ago

  • Affected Puppet version set to 2.7.12

#4 Updated by Dominic Cleal about 2 years ago

Thanks for the report. I agree it looks very much like #13204, which as you say is masking the underlying issue. The issue in that case was a bug in Augeas which I fixed in git a few days ago: issue 264. It caused duplicate filenames to appear in cases where multiple top level directories were parsed by Augeas. You could confirm if this is the same issue with “augtool ls /files”.

I intend to push forward with the workaround to hide the Augeas bug as there are lots of old Augeas versions out there being used in combination with Puppet. The #11988 changes exposed this bug as they changed the interaction with Augeas, so again, probably best to work around it in Puppet too.

#5 Updated by Tim Bishop about 2 years ago

Hi Dominic, thanks for looking at this issue.

Here’s the augtool output:

% augtool ls /files
boot/ = (none)
etc/ = (none)
%

I’ve patched my augeas with the fix you committed in the Augeas git and I can confirm the issue is fixed.

So yes, I now agree with you. Since it’s a bug in Augeas it makes sense to fix it there and add a workaround to Puppet for systems with an older Augeas on it.

Any idea on an ETA for the next Augeas release? I’ll see if the FreeBSD port maintainer will apply you fix to the port in the interim which will resolve the issue for me.

Thanks again.

#6 Updated by Dominic Cleal about 2 years ago

  • Status changed from Unreviewed to Duplicate

Ok, thanks for testing the Augeas fix too. I think David’s looking at a new release in the next week or two.

#7 Updated by Benoit Donneaux almost 2 years ago

Not sure it will help, but I’ve got the same issue on CentOS 5 since puppet 2.7.12-1.el5 with augeas-libs-0.10.0-3.el5.

When it’s still working fine on CentOS 5 and 6, with puppet 2.7.13-1.el5/6 and augeas-libs-0.9.0-1.el5/6.

I’ve downgraded augeas from 0.10.0 to 0.9.0, waiting for a fix…

#8 Updated by Dominic Cleal almost 2 years ago

Benoit Donneaux wrote:

Not sure it will help, but I’ve got the same issue on CentOS 5 since puppet 2.7.12-1.el5 with augeas-libs-0.10.0-3.el5.

When it’s still working fine on CentOS 5 and 6, with puppet 2.7.13-1.el5/6 and augeas-libs-0.9.0-1.el5/6.

Odd, 2.7.13 should be affected – it should be 2.7.11 that works.

I’ve downgraded augeas from 0.10.0 to 0.9.0, waiting for a fix…

The fix from #13204 went into 2.7.14rc1, and 2.7.14 itself will be released shortly.

#9 Updated by Rich Rauenzahn almost 2 years ago

Is there a workaround for this that doesn’t require an upgrade? We’re seeing this on just a couple of machines in /etc/sysctl.conf.

…it looks like the only workaround is to hand apply the augeas change to the file?

(I’d rather not upgrade augeas to a non official release; and a puppet upgrade when 14 release will take a bit of time to roll out)

#10 Updated by Dominic Cleal almost 2 years ago

Rich Rauenzahn wrote:

Is there a workaround for this that doesn’t require an upgrade? We’re seeing this on just a couple of machines in /etc/sysctl.conf.

…it looks like the only workaround is to hand apply the augeas change to the file?

You could probably set the “lens” and “incl” parameters:

lens => "Sysctl.lns",
incl => "/etc/sysctl.conf",

That should have the effect of avoiding the bug in Augeas.

(I’d rather not upgrade augeas to a non official release; and a puppet upgrade when 14 release will take a bit of time to roll out)

Augeas hasn’t had a release out that fixes the underlying issue. Puppet 2.7.14 has already been released and resolves the error.

Also available in: Atom PDF