Bug 1043636

Summary: augeas-libs 1.0.0-5 breaks loading of /etc/sysconfig/nfs file
Product: Red Hat Enterprise Linux 6 Reporter: Jonathan Underwood <jonathan.underwood>
Component: augeasAssignee: Dominic Cleal <dcleal>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.5CC: huzhan, jonathan.underwood, leiwang, lkong
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: augeas-1.0.0-6.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1043665 (view as bug list) Environment:
Last Closed: 2014-10-14 07:15:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1043665    
Attachments:
Description Flags
/etc/sysconfig/nfs
none
output of puppet agent --debug --no-daemonize > puppet.log 2> &1 none

Description Jonathan Underwood 2013-12-16 19:07:39 UTC
Description of problem:
augeas-libs 0.9.0-4.el6 allowed the following puppet snippet to work as it should:

    augeas {
      '/etc/sysconfig/nfs':
        context => '/files/etc/sysconfig/nfs',
        lens    => 'Sysconfig.lns',
        incl    => '/etc/sysconfig/nfs',
        changes => [ "set SECURE_NFS $nfsv4secure", ];
      '/etc/idmapd.conf':
        context => '/files/etc/idmapd.conf/General',
        lens    => 'Puppet.lns',
        incl    => '/etc/idmapd.conf',
        changes => ["set Domain ${nfs::client::redhat::nfs_v4_idmap_domain}"],
    }

Updating to 1.0.0-5 breaks this:

Dec 16 19:01:38 aws0 puppet-agent[18234]: Starting Puppet client version 3.3.1
Dec 16 19:01:46 aws0 puppet-agent[18238]: (Augeas[/etc/sysconfig/nfs](provider=augeas)) Loading failed for one or more files, see debug for /augeas//error output
Dec 16 19:01:46 aws0 puppet-agent[18238]: (/Stage[main]/Nfs::Client::Redhat::Configure/Augeas[/etc/sysconfig/nfs]) Could not evaluate: Save failed with return code false, see debug


Version-Release number of selected component (if applicable):
1.0.0-5

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Dominic Cleal 2013-12-16 19:10:41 UTC
Please attach the contents of /etc/sysconfig/nfs to the BZ, as it's failing to load the file.

It'd also be useful if you can provide debug output from Puppet (--debug).

Comment 2 Jonathan Underwood 2013-12-16 19:25:25 UTC
Created attachment 837386 [details]
/etc/sysconfig/nfs

/etc/sysconfig/nfs

Comment 3 Jonathan Underwood 2013-12-16 19:26:01 UTC
Nb. downgrading to 0.9.0-4.el6 allows the augeas resource to complete succesfully.

Comment 4 Jonathan Underwood 2013-12-16 19:31:00 UTC
Created attachment 837387 [details]
output of puppet agent --debug --no-daemonize > puppet.log 2> &1

Comment 5 Jonathan Underwood 2013-12-16 19:32:46 UTC
Relevant part seems to be:

ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): Opening augeas with root /, lens path , flags 64ESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): Augeas version 1.0.0 is installedESC[0m
ESC[1;31mWarning: Augeas[/etc/sysconfig/nfs](provider=augeas): Loading failed for one or more files, see debug for /augeas//error outputESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): /augeas/files/etc/sysconfig/nfs/error = parse_failedESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): /augeas/files/etc/sysconfig/nfs/error/pos = 159ESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): /augeas/files/etc/sysconfig/nfs/error/line = 7ESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): /augeas/files/etc/sysconfig/nfs/error/char = 0ESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): /augeas/files/etc/sysconfig/nfs/error/lens = /usr/share/augeas/lenses/dist/sysconfig.aug:62.12-.71:ESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): /augeas/files/etc/sysconfig/nfs/error/message = Get did not match entire inputESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): Will attempt to save and only run if files changedESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/nfs/SECURE_NFS", "yes"]ESC[0m
ESC[0;36mDebug: Augeas[/etc/sysconfig/nfs](provider=augeas): Closed the augeas connectionESC[0m
ESC[1;31mError: /Stage[main]/Nfs::Client::Redhat::Configure/Augeas[/etc/sysconfig/nfs]: Could not evaluate: Save failed with return code false, see debugESC[0m

Comment 6 Jonathan Underwood 2013-12-16 19:53:49 UTC
Ugh, a diff of the sysconfig lens between the 0.9 and 1.0 packages shows a heap of changes.

Comment 7 Dominic Cleal 2013-12-16 19:58:30 UTC
(In reply to Jonathan Underwood from comment #6)
> Ugh, a diff of the sysconfig lens between the 0.9 and 1.0 packages shows a
> heap of changes.

Ah, I hadn't noticed you were using the Sysconfig module.  I'd recommend using Shellvars.lns instead, as this is the default lens for handling /etc/sysconfig/*.

Shellvars generally gets more attention and is far more extensive for handling shell-style files.

Comment 8 Dominic Cleal 2013-12-16 20:53:51 UTC
Upstream as 92274bd3ff47d3cc4511d934dae06f16b59db7ad.

Steps to Reproduce:
1. augtool -A --transform "Sysconfig incl /etc/sysconfig/nfs" print /augeas/files/etc/sysconfig/nfs/error
2. augtool -A --transform "Sysconfig incl /etc/sysconfig/nfs" print /files/etc/sysconfig/nfs/

Actual results:
/augeas/files/etc/sysconfig/nfs/error = "parse_failed"
/augeas/files/etc/sysconfig/nfs/error/pos = "159"
/augeas/files/etc/sysconfig/nfs/error/line = "7"
/augeas/files/etc/sysconfig/nfs/error/char = "0"
/augeas/files/etc/sysconfig/nfs/error/lens = "/usr/share/augeas/lenses/dist/sysconfig.aug:62.12-.71:"
/augeas/files/etc/sysconfig/nfs/error/message = "Get did not match entire input"

Second command prints no output.

Expected results:
No output from the first command.

~54 lines of output from the second command:
/files/etc/sysconfig/nfs/#comment[1] = "Define which protocol versions mountd"
/files/etc/sysconfig/nfs/#comment[2] = "will advertise. The values are \"no\" or \"yes\""
/files/etc/sysconfig/nfs/#comment[3] = "with yes being the default"

Comment 9 Jonathan Underwood 2013-12-16 23:08:38 UTC
(In reply to Dominic Cleal from comment #7)
> (In reply to Jonathan Underwood from comment #6)
> > Ugh, a diff of the sysconfig lens between the 0.9 and 1.0 packages shows a
> > heap of changes.
> 
> Ah, I hadn't noticed you were using the Sysconfig module.  I'd recommend
> using Shellvars.lns instead, as this is the default lens for handling
> /etc/sysconfig/*.
> 
> Shellvars generally gets more attention and is far more extensive for
> handling shell-style files.


OK, can confirm that switching to the Shellvars lens fixes things. However, I worry that this update will have broken existing code for other people using the Sysconfig lens, so I think a fix for that lens is still probably needed in any case.

[Aside: I can't help but wonder why upstream still ships the Sysconfig lens, and keep it different to the Shellvars lens. A possible fix might just be to copy the Shellvars lens to the Sysconfig.aug file and change the module name.]

Anyway, thanks for the quick response on this, much appreciated.

Comment 10 Lingfei Kong 2013-12-17 03:35:14 UTC
Can reproduce with augeas-1.0.0-5.el6


Steps to reproduce:
1. 
#augtool -A --transform "Sysconfig incl /etc/sysconfig/nfs" print /augeas/files/etc/sysconfig/nfs/error
/augeas/files/etc/sysconfig/nfs/error = "parse_failed"
/augeas/files/etc/sysconfig/nfs/error/pos = "159"
/augeas/files/etc/sysconfig/nfs/error/line = "7"
/augeas/files/etc/sysconfig/nfs/error/char = "0"
/augeas/files/etc/sysconfig/nfs/error/lens = "/usr/share/augeas/lenses/dist/sysconfig.aug:62.12-.71:"
/augeas/files/etc/sysconfig/nfs/error/message = "Get did not match entire input"


2. 
#augtool -A --transform "Sysconfig incl /etc/sysconfig/nfs" print /files/etc/sysconfig/nfs/

No output.

Comment 11 Dominic Cleal 2013-12-17 08:51:47 UTC
(In reply to Jonathan Underwood from comment #9)
> [Aside: I can't help but wonder why upstream still ships the Sysconfig lens,
> and keep it different to the Shellvars lens. A possible fix might just be to
> copy the Shellvars lens to the Sysconfig.aug file and change the module
> name.]

The intention appears to have been to support a subset of shell functionality for /etc/sysconfig/ files (e.g. no backticks or arrays), and to hide some implementation details of the shell like quoting which Shellvars passes through.  That said, the lens has yet to become the default for these files.

Comment 12 Jonathan Underwood 2013-12-17 18:35:53 UTC
Do you plan to push a fix to this for RHEL 6.4 & 6.5? I am looking at quite a few broken puppet modules right now, and pondering if I should fix them all, or wait for an update.

Comment 13 Dominic Cleal 2013-12-17 18:51:34 UTC
(In reply to Jonathan Underwood from comment #12)
> Do you plan to push a fix to this for RHEL 6.4 & 6.5? I am looking at quite
> a few broken puppet modules right now, and pondering if I should fix them
> all, or wait for an update.

RHEL 6.4 contains Augeas 0.9.0, so it's unaffected.

For 6.5 (which supplied 1.0.0), as per https://access.redhat.com/site/support/policy/updates/errata/, only "qualified [..] Urgent and Selected High Priority Bug Fix errata advisories (RHBAs) may be released as they become available", so this is unlikely to qualify.  Please raise this via support if you have a subscription and feel it meets this criteria.  Thanks.

Comment 14 Jonathan Underwood 2013-12-19 11:42:54 UTC
OK, support case raised (Case 01001859).

Comment 16 Lingfei Kong 2014-06-04 09:27:52 UTC
Verified with augeas-1.0.0-6.el6

Steps to verify:
1. #augtool -A --transform "Sysconfig incl /etc/sysconfig/nfs" print /augeas/files/etc/sysconfig/nfs/error
No output

2. #augtool -A --transform "Sysconfig incl /etc/sysconfig/nfs" print /files/etc/sysconfig/nfs/
/files/etc/sysconfig/nfs
/files/etc/sysconfig/nfs/#comment[1] = "Define which protocol versions mountd"
/files/etc/sysconfig/nfs/#comment[2] = "will advertise. The values are \"no\" or \"yes\""
/files/etc/sysconfig/nfs/#comment[3] = "with yes being the default"
/files/etc/sysconfig/nfs/#comment[4] = "MOUNTD_NFS_V2=\"no\""
/files/etc/sysconfig/nfs/#comment[5] = "MOUNTD_NFS_V3=\"no\""
/files/etc/sysconfig/nfs/#comment[6] = "Path to remote quota server. See rquotad(8)"
/files/etc/sysconfig/nfs/#comment[7] = "RQUOTAD=\"/usr/sbin/rpc.rquotad\""
/files/etc/sysconfig/nfs/#comment[8] = "Port rquotad should listen on."
/files/etc/sysconfig/nfs/#comment[9] = "RQUOTAD_PORT=875"
....

Result:
~54 lines of output from the second command:
/files/etc/sysconfig/nfs/#comment[1] = "Define which protocol versions mountd"
/files/etc/sysconfig/nfs/#comment[2] = "will advertise. The values are \"no\" or \"yes\""
/files/etc/sysconfig/nfs/#comment[3] = "with yes being the default"

Comment 17 errata-xmlrpc 2014-10-14 07:15:34 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1517.html