russell.fulton
2011-Apr-12 03:44 UTC
[Puppet Users] augtool/augeas -- clearly missing something...
Hi I''ve just started trying to use augeas to manage /etc/network/ interfaces on Ubuntu.... I found some stuff in the archive that seems to match what I need but I can''t make anything work. I have augeas { "network_interface": context => "/etc/network/interfaces", changes => [ "set auto[.= eth1] eth1", "set iface[.= eth1] eth1", "set iface[.= eth1]/family inet ", "set iface[.= eth1]/method manual ", } This does not produce any errors but does not do anything either. I installed augtool on the box and tried: cp /etc/network/interfaces . rful011@mon225044:~$ augtool augtool> set file/interfaces/iface[eth1] eth1 augtool> set file/interfaces/iface[eth1]/family inet augtool> set file/interfaces/iface[eth1]/method manual augtool> save augtool> ls file/interfaces/iface[eth1] augtool> quit again no errors (no feedback at all ?) and no changes to the file. Clearly I am missing something! Russell -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Adam Heinz
2011-Apr-12 16:16 UTC
Re: [Puppet Users] augtool/augeas -- clearly missing something...
> context => "/etc/network/interfaces",Shouldn''t this be "/files/etc/network/interfaces"? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Russell Fulton
2011-Apr-12 20:46 UTC
Re: [Puppet Users] augtool/augeas -- clearly missing something...
On 13/04/2011, at 4:16 AM, Adam Heinz wrote:>> context => "/etc/network/interfaces", > > Shouldn''t this be "/files/etc/network/interfaces"?indeed! now I get: err: /Stage[main]//Node[mon225044.insec.auckland.ac.nz]/Augeas[network_interface]/returns: change from need_to_run to 0 failed: Save failed with return code false so it is now trying to do something. I just have to figure out what! :) It had to be something simple. THanks, Russell -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
russell.fulton
2011-Apr-12 22:43 UTC
[Puppet Users] Re: augtool/augeas -- clearly missing something...
On Apr 13, 4:16 am, Adam Heinz <a...@metricwise.net> wrote:> > context => "/etc/network/interfaces", > > Shouldn''t this be "/files/etc/network/interfaces"?Thanks! that was the thing I was missing. The iface stuff works fine now but I can''t figure out how to add a new auto line "set auto[. = ''eth1''] eth1", gives an error on save ? augtool shows auto[1] having multiple values: augtool> ls /files/etc/network/interfaces/auto 1 = lo 1 = eth0 so how should I add entries? and by the way http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas is the best augtool documentation I found -- more in depth than the quick tour on the augtool site. Russell -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dominic Cleal
2011-Apr-13 11:38 UTC
Re: [Puppet Users] Re: augtool/augeas -- clearly missing something...
On 12/04/11 23:43, russell.fulton wrote:> On Apr 13, 4:16 am, Adam Heinz <a...@metricwise.net> wrote: >>> context => "/etc/network/interfaces", >> >> Shouldn''t this be "/files/etc/network/interfaces"? > > Thanks! that was the thing I was missing. > > The iface stuff works fine now but I can''t figure out how to add a new > auto line > > "set auto[. = ''eth1''] eth1", > > gives an error on save ? > > augtool shows auto[1] having multiple values: > > augtool> ls /files/etc/network/interfaces/auto > 1 = lo > 1 = eth0 > > so how should I add entries?So that method is trying to set the value of auto to ''eth1'', but the tree layout has a ''1'' node under each ''auto'' node. The best way to see this is to look at augtool''s print command: augtool> print /files/etc/network/interfaces/auto /files/etc/network/interfaces/auto[1] /files/etc/network/interfaces/auto[1]/1 = "lo" /files/etc/network/interfaces/auto[2] /files/etc/network/interfaces/auto[2]/1 = "eth0" When setting it, you need to have the ''1'' node in there too: set auto[child::1 = ''eth1'']/1 eth1> and by the way http://projects.puppetlabs.com/projects/puppet/wiki/Puppet_Augeas > is the best augtool documentation I found -- more in depth than the > quick tour on the augtool site.Yep, the quick tour is limited. The wiki has some very useful info hidden on it about constructing expressions, in particular: http://augeas.net/page/Path_expressions http://augeas.net/docs/tree.html There isn''t much specific to augtool as it mirrors the API itself. What you might find useful is a new book that Raphaël Pinson''s been working on, which starts explaining it from the beginning - it''s still work in progress though. https://github.com/raphink/Augeas-book/ (you''ll need to clone and ''make'' it) Lastly, there are a few of us in #augeas on Freenode who can lend you a hand with expressions if you get stuck. -- Dominic Cleal Red Hat Consulting m: +44 (0)7818 512168 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Dominic Cleal
2011-Apr-13 12:19 UTC
Re: [Puppet Users] Re: augtool/augeas -- clearly missing something...
On 13/04/11 12:38, Dominic Cleal wrote:> What you might find useful is a new book that Raphaël Pinson''s been > working on, which starts explaining it from the beginning - it''s still > work in progress though. > > https://github.com/raphink/Augeas-book/ > (you''ll need to clone and ''make'' it)Correction, Raphaël''s got a PDF up here for easy reading: http://r.pinson.free.fr/augeas/augeas-book.pdf -- Dominic Cleal Red Hat Consulting m: +44 (0)7818 512168 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Rudy Gevaert
2011-Apr-13 13:44 UTC
Re: [Puppet Users] Re: augtool/augeas -- clearly missing something...
just asan informational note, look at the manifest I attached. I''m using it to add tunl0 devices. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.