Augeas hates me!!!

120 views
Skip to first unread message

randal cobb

unread,
Aug 12, 2014, 4:22:46 PM8/12/14
to puppet...@googlegroups.com
Hello, all!

I am trying to add some new modules to an openSuse 13.1 host with Puppet and Augeas with no luck.  The modules themselves are already installed by the example42/apache module, but I can't get the apache::module syntax to properly add the modules to the proper openSuse config files.  So, I'm opting for Augeas to do the dirty-work.  I have the following definition in the server's manifest (dev-apache.pp) file (the apache::module command are still there, but don't work, so the augeas section is the brute-force attempt; I just included them both so you can see the current state of this class manifest):
 
        ...

        apache
::module { 'status': }
        apache
::module { 'asis': }
        apache
::module { 'auth_digest': }
        apache
::module { 'headers': }
        apache
::module { 'proxy': }
        apache
::module { 'proxy_http': }
        apache
::module { 'rewrite': }
        apache
::module { 'vhost_alias': }
        apache
::module { 'authz_default': }
        apache
::module { 'proxy_balancer': }

    augeas
{ 'apache2':
        context
=> "/files/etc/sysconfig/apache2",
        lens    
=> "sysconfig.lns",
        incl    
=> '/usr/share/augeas/lenses/dist/',
        changes
=>
               
'set APACHE_MODULES "actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir reqtimeout authn_core authz_core status asis auth_digest headers proxy proxy_http rewrite vhost_alias authz_default proxy_balancer"',
   
}
   
...

When running the agent in --debug --verbose --test, I get this debug output from augeas:

Debug: Augeas[apache2](provider=augeas): Opening augeas with root /, lens path , flags 64
Debug: Augeas[apache2](provider=augeas): Augeas version 1.0.0 is installed
Debug: Augeas[apache2](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[apache2](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/apache2/APACHE_MODULES", "actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir reqtimeout authn_core authz_core status asis auth_digest headers proxy proxy_http rewrite vhost_alias authz_default proxy_balancer"]
Debug: Augeas[apache2](provider=augeas): Skipping because no files were changed
Debug: Augeas[apache2](provider=augeas): Closed the augeas connection


No errors, but the file is marked as unchanged.  

Before the puppet run, /etc/sysconfig/apache2 contains this line:
APACHE_MODULES="foo"
and obviously, it's the same afterwards.

Any insight into what I may be doing wrong?

Vikas Kumar

unread,
Aug 12, 2014, 8:38:59 PM8/12/14
to puppet...@googlegroups.com
Hello,

I think double quotes in your set statement are the culprit.

Try to use set as below

'set /files/whatever/path \'"your text in quotes"\'',



Regards,
Vikas

randal cobb

unread,
Aug 12, 2014, 8:41:02 PM8/12/14
to puppet...@googlegroups.com

Thanks,  I'll give that a try in the morning.

--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/BPOYk4BU-bY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/8698f74d-b5cf-470f-983e-ca170861d468%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

randal cobb

unread,
Aug 13, 2014, 11:22:37 AM8/13/14
to puppet...@googlegroups.com
ok, that didn't seem to help.  I now have this result:
Debug: Augeas[apache2](provider=augeas): Opening augeas with root /, lens path , flags 64
Debug: Augeas[apache2](provider=augeas): Augeas version 1.0.0 is installed
Debug: Augeas[apache2](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[apache2](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/apache2/APACHE_MODULES", "\"actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir reqtimeout authn_core authz_core status asis auth_digest headers proxy proxy_http rewrite vhost_alias authz_default proxy_balancer\""]
Debug: Augeas[apache2](provider=augeas): Skipping because no files were changed
Debug: Augeas[apache2](provider=augeas): Closed the augeas connection


from this manifest entry:
    augeas { 'apache2':
        context
=> "/files/etc/sysconfig/apache2",
        lens    
=> "sysconfig.lns",
        incl    
=> '/usr/share/augeas/lenses/dist/',
        changes
=>
               
'set APACHE_MODULES \'"actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir reqtimeout authn_core authz_core status asis auth_digest headers proxy proxy_http rewrite vhost_alias authz_default proxy_balancer"\'',
   
}




John Warburton

unread,
Aug 13, 2014, 9:35:40 PM8/13/14
to puppet-users
On 14 August 2014 01:22, randal cobb <rco...@gmail.com> wrote:
ok, that didn't seem to help.  I now have this result:
Debug: Augeas[apache2](provider=augeas): Opening augeas with root /, lens path , flags 64

You may find templates much easier to manage

I gave up on Augeas a long time ago due to this complexity, lack of lenses and because to someone looking at a file, it wasn't obvious augeas/puppet was managing it. A file with VCS artefacts at the top makes it more obvious what is going on..

John

Poil

unread,
Aug 14, 2014, 2:17:26 AM8/14/14
to puppet...@googlegroups.com
Hi,

I think you can use "file_line" from stdlib https://forge.puppetlabs.com/puppetlabs/stdlib#file_line
It's really more simple than Augeas and it works better.

For multi-line I also use "editfile" a custom module, but you need to be good with regex =) https://github.com/mstrauss/puppet-editfile

Best regards,
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/3d666f47-8b6e-436a-8791-a15e50ab9771%40googlegroups.com.

Wil Cooley

unread,
Aug 18, 2014, 1:21:23 PM8/18/14
to puppet-users group
On Wed, Aug 13, 2014 at 8:22 AM, randal cobb <rco...@gmail.com> wrote:
from this manifest entry:
    augeas { 'apache2':
        context
=> "/files/etc/sysconfig/apache2",
        lens    
=> "sysconfig.lns",
        incl    
=> '/usr/share/augeas/lenses/dist/',
        changes
=>
               
'set APACHE_MODULES \'"actions alias auth_basic authn_file authz_host authz_groupfile authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir reqtimeout authn_core authz_core status asis auth_digest headers proxy proxy_http rewrite vhost_alias authz_default proxy_balancer"\'',
   
}

Try instead:

  augeas { 'apache2':
    incl    => '/etc/sysconfig/apache2',
    lens    => 'Sysconfig.lns',
    changes => ...
  }

 You probably don't *need* either the "incl" or "lens" parameters but my experience is that agent performance is absymal without them; otherwise Augeas will scan and load all of the files it knows about when it starts up, which is slow -- and coupled with the fact the Puppet provider creates a new Augeas instance for every resource (unless this bug has been fixed), it's really slow.

You might find more help with the Augeas guide:


As others have said, Augeas can be tough to get your head around, in part because there are at least 4 or 5 different "languages" involved, some of which are confusingly similar or bleed into each other:
  • Lens schema language
  • Path expressions (and the link to the path expression doc is buried in the "Tree" page and 404 anyway; should be https://github.com/hercules-team/augeas/wiki/Path-expressions)
  • Tree structure & magic control files under "/augeas"
  • Tree manipulation and query commands which are similar but not wholly isomorphic:
    • "augtool" commands
    • Puppet parameters for Augeas type
    • Language bindings aka "public API": C, Ruby
To effectively test and develop Puppet resources, you need everything EXCEPT the lens schema language. Unfortunately, if you click the "Documentation" link on augeas.net, only the first sub-items are NOT related to lens schema development. And docs extracted under "Stock Lenses" is a muddle of both.

Wil
Reply all
Reply to author
Forward
0 new messages