I need to be able to add: alias usb-storage off to /etc/modprobe.conf I have this so far: augeas { "usb-storage": context => "/files/etc/modprobe.conf", changes => [ "set alias[last()+1] usb-storage", "set alias[last()]/modulename off", ], onlyif => "get alias != usb-storage" } The change works, but the onlyif part does not. augtool> print /files/etc/modprobe.conf/alias[*] /files/etc/modprobe.conf/alias[1] = "eth0" /files/etc/modprobe.conf/alias[1]/modulename = "vmnics" /files/etc/modprobe.conf/alias[2] = "scsi_hostadapter" /files/etc/modprobe.conf/alias[2]/modulename = "mptbase" /files/etc/modprobe.conf/alias[3] = "scsi_hostadapter1" /files/etc/modprobe.conf/alias[3]/modulename = "mptscsih" /files/etc/modprobe.conf/alias[4] = "char-major-14" I need to be able to detect if usb-storage already exists as a module name, so I don''t add the alias line multiple times. I''ve tried several things, but none of them seem to do what I want. Does anybody have any ideas? I''m still experimenting, and if I find an answer, I''ll post it. Thanks /lsd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
lance dillon wrote:> I need to be able to add: > > alias usb-storage off > > to /etc/modprobe.conf > > I have this so far: > > augeas { "usb-storage": > context => "/files/etc/modprobe.conf", > changes => [ "set alias[last()+1] usb-storage", > "set alias[last()]/modulename off", > ], > onlyif => "get alias != usb-storage" > }try onlyif => "match alias include usb-storage" it may be "match alias[*] include usb-storage" -- bk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Jun 9, 2009 at 11:16 AM, Bryan Kearney <bkearney@redhat.com> wrote:> > lance dillon wrote: > > I need to be able to add: > > > > alias usb-storage off > > > > to /etc/modprobe.conf > > > > I have this so far: > > > > augeas { "usb-storage": > > context => "/files/etc/modprobe.conf", > > changes => [ "set alias[last()+1] usb-storage", > > "set alias[last()]/modulename off", > > ], > > onlyif => "get alias != usb-storage" > > } > > > try onlyif => "match alias include usb-storage" > > it may be > > "match alias[*] include usb-storage" > > -- bk > > > Hmm, that didn''t quite do it either. Now it doesn''t run regardless. It issupposed to add that line if usb-storage doesn''t exist, and ignore if it does (I don''t want to add it multiple times). The logic above seems to be the opposite, but either way, nothing happened. Thanks for the info though. Now I have another command to check with (using include). --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
lance dillon wrote:> On Tue, Jun 9, 2009 at 11:16 AM, Bryan Kearney <bkearney@redhat.com> wrote: > >> lance dillon wrote: >>> I need to be able to add: >>> >>> alias usb-storage off >>> >>> to /etc/modprobe.conf >>> >>> I have this so far: >>> >>> augeas { "usb-storage": >>> context => "/files/etc/modprobe.conf", >>> changes => [ "set alias[last()+1] usb-storage", >>> "set alias[last()]/modulename off", >>> ], >>> onlyif => "get alias != usb-storage" >>> } >> >> try onlyif => "match alias include usb-storage" >> >> it may be >> >> "match alias[*] include usb-storage" >> >> -- bk >> >> >> Hmm, that didn''t quite do it either. Now it doesn''t run regardless. It is > supposed to add that line if usb-storage doesn''t exist, and ignore if it > does (I don''t want to add it multiple times). The logic above seems to be > the opposite, but either way, nothing happened. > > Thanks for the info though. Now I have another command to check with (using > include). >Ok.. lets try this (lutter knows this voodoo better) "match *[alias =''usb-storage''] size = 0 " -- bk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Jun 9, 2009 at 11:57 AM, Bryan Kearney <bkearney@redhat.com> wrote:> > lance dillon wrote: > > On Tue, Jun 9, 2009 at 11:16 AM, Bryan Kearney <bkearney@redhat.com> > wrote: > > > >> lance dillon wrote: > >>> I need to be able to add: > >>> > >>> alias usb-storage off > >>> > >>> to /etc/modprobe.conf > >>> > >>> I have this so far: > >>> > >>> augeas { "usb-storage": > >>> context => "/files/etc/modprobe.conf", > >>> changes => [ "set alias[last()+1] usb-storage", > >>> "set alias[last()]/modulename off", > >>> ], > >>> onlyif => "get alias != usb-storage" > >>> } > >> > >> try onlyif => "match alias include usb-storage" > >> > >> it may be > >> > >> "match alias[*] include usb-storage" > >> > >> -- bk > >> > >> > >> Hmm, that didn''t quite do it either. Now it doesn''t run regardless. It > is > > supposed to add that line if usb-storage doesn''t exist, and ignore if it > > does (I don''t want to add it multiple times). The logic above seems to > be > > the opposite, but either way, nothing happened. > > > > Thanks for the info though. Now I have another command to check with > (using > > include). > > > > Ok.. lets try this (lutter knows this voodoo better) > > "match *[alias =''usb-storage''] size = 0 " > > -- bk >Seems closer, but not quite. augtool> match /files/etc/modprobe.conf/alias[*] /files/etc/modprobe.conf/alias[1] = eth0 /files/etc/modprobe.conf/alias[2] = scsi_hostadapter /files/etc/modprobe.conf/alias[3] = scsi_hostadapter1 /files/etc/modprobe.conf/alias[4] = char-major-14 /files/etc/modprobe.conf/alias[5] = usb-storage augtool> match /files/etc/modprobe.conf/alias[*=''usb-storage''] (no matches) augtool> match /files/etc/modprobe.conf/alias[=''usb-storage''] (error matching /files/etc/modprobe.conf/alias[=''usb-storage'']) augtool> match /files/etc/modprobe.conf/alias[*=''usb-storage''] (no matches) augtool> match /files/etc/modprobe.conf/alias[*="usb-storage"] (no matches) This may give more information. thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
lance dillon wrote:> On Tue, Jun 9, 2009 at 11:57 AM, Bryan Kearney <bkearney@redhat.com> wrote: > >> lance dillon wrote: >>> On Tue, Jun 9, 2009 at 11:16 AM, Bryan Kearney <bkearney@redhat.com> >> wrote: >>>> lance dillon wrote: >>>>> I need to be able to add: >>>>> >>>>> alias usb-storage off >>>>> >>>>> to /etc/modprobe.conf >>>>> >>>>> I have this so far: >>>>> >>>>> augeas { "usb-storage": >>>>> context => "/files/etc/modprobe.conf", >>>>> changes => [ "set alias[last()+1] usb-storage", >>>>> "set alias[last()]/modulename off", >>>>> ], >>>>> onlyif => "get alias != usb-storage" >>>>> } >>>> try onlyif => "match alias include usb-storage" >>>> >>>> it may be >>>> >>>> "match alias[*] include usb-storage" >>>> >>>> -- bk >>>> >>>> >>>> Hmm, that didn''t quite do it either. Now it doesn''t run regardless. It >> is >>> supposed to add that line if usb-storage doesn''t exist, and ignore if it >>> does (I don''t want to add it multiple times). The logic above seems to >> be >>> the opposite, but either way, nothing happened. >>> >>> Thanks for the info though. Now I have another command to check with >> (using >>> include). >>> >> Ok.. lets try this (lutter knows this voodoo better) >> >> "match *[alias =''usb-storage''] size = 0 " >> >> -- bk >> > Seems closer, but not quite. > > augtool> match /files/etc/modprobe.conf/alias[*] > /files/etc/modprobe.conf/alias[1] = eth0 > /files/etc/modprobe.conf/alias[2] = scsi_hostadapter > /files/etc/modprobe.conf/alias[3] = scsi_hostadapter1 > /files/etc/modprobe.conf/alias[4] = char-major-14 > /files/etc/modprobe.conf/alias[5] = usb-storage > augtool> match /files/etc/modprobe.conf/alias[*=''usb-storage''] > (no matches) > augtool> match /files/etc/modprobe.conf/alias[=''usb-storage''] > (error matching /files/etc/modprobe.conf/alias[=''usb-storage'']) > augtool> match /files/etc/modprobe.conf/alias[*=''usb-storage''] > (no matches) > augtool> match /files/etc/modprobe.conf/alias[*="usb-storage"] > (no matches) > > This may give more information. > > thanksok.. I think this is it in augtool: match /files/etc/modprobe.conf/*[.="foo"] so.. in the plugin you can do ''match /files/etc/modprobe.conf/*[.="foo"] size = 0'' -- bk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bryan Kearney wrote:>> thanks > > > ok.. I think this is it in augtool: > > match /files/etc/modprobe.conf/*[.="foo"] > > so.. in the plugin you can do > > ''match /files/etc/modprobe.conf/*[.="foo"] size = 0'' >more specific matching: match /files/etc/modprobe.conf/alias[.="foo"] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Jun 9, 2009 at 1:09 PM, Bryan Kearney <bkearney@redhat.com> wrote:> > Bryan Kearney wrote: > >> thanks > > > > > > ok.. I think this is it in augtool: > > > > match /files/etc/modprobe.conf/*[.="foo"] > > > > so.. in the plugin you can do > > > > ''match /files/etc/modprobe.conf/*[.="foo"] size = 0'' > > > > more specific matching: > > match /files/etc/modprobe.conf/alias[.="foo"] >The problem with modprobe.conf is that it is more like: command args than key value key value usually has unique keys, but command args doesn''t. It''s kind of weird A lot of those commands work on something else, say /etc/hosts, or /etc/fstab, something that is key value, but just not working on /etc/modprobe.conf. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
lance dillon wrote:> On Tue, Jun 9, 2009 at 1:09 PM, Bryan Kearney <bkearney@redhat.com> wrote: > >> Bryan Kearney wrote: >>>> thanks >>> >>> ok.. I think this is it in augtool: >>> >>> match /files/etc/modprobe.conf/*[.="foo"] >>> >>> so.. in the plugin you can do >>> >>> ''match /files/etc/modprobe.conf/*[.="foo"] size = 0'' >>> >> more specific matching: >> >> match /files/etc/modprobe.conf/alias[.="foo"] >> > The problem with modprobe.conf is that it is more like: > > command args > > than > > key value > > > key value usually has unique keys, but command args doesn''t. > > It''s kind of weird A lot of those commands work on something else, say > /etc/hosts, or /etc/fstab, something that is key value, but just not working > on /etc/modprobe.conf.Can you please send me your target modprobe.conf file? -- bk --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > The problem with modprobe.conf is that it is more like: > > > > command args > > > > than > > > > key value > > > > > > key value usually has unique keys, but command args doesn''t. > > > > It''s kind of weird A lot of those commands work on something else, say > > /etc/hosts, or /etc/fstab, something that is key value, but just not > working > > on /etc/modprobe.conf. > > > Can you please send me your target modprobe.conf file? > > -- bk >alias eth0 vmnics alias scsi_hostadapter mptbase alias scsi_hostadapter1 mptscsih install bond0 /sbin/modprobe bonding -o bond0 miimon=100 mode=1 # Added by VMware Tools install pcnet32 /sbin/modprobe -q --ignore-install vmxnet;/sbin/modprobe -q --ignore-install pcnet32 $CMDLINE_OPTS;/bin/true alias char-major-14 sb options sb io=0x220 irq=5 dma=1 dma16=5 mpu_io=0x330 #alias usb-storage off If alias usb-storage off isn''t present, it should add it, otherwise do nothing. Like I said, I''m still experimenting with options, but nothing has worked right yet. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, 2009-06-09 at 11:57 -0400, Bryan Kearney wrote:> Ok.. lets try this (lutter knows this voodoo better)It''s not voodoo, it''s XPath ;)> "match *[alias =''usb-storage''] size = 0 "That almost works, though shouldn''t that second ''='' be ''=='' ? (and maybe we should make the augeas provider use ''='' there, too, for consistency) I would write this as augeas { "usb-storage": context => "/files/etc/modprobe.conf", changes => [ "set alias[last()+1] usb-storage", "set alias[last()]/modulename off", ], onlyif => "match alias[.=''usb-storage''] size == 0'' } The fact that the modprobe.conf format is ''command args'' with differing meanings of the args for the various commands doesn''t matter too much - it just leads to different tree structures for those commands. For example for the command ''alias NAME MODULE'' the tree structure is alias = ''NAME'' modulename = ''MODULE'' IOW, the name of the alias becomes the value of the ''alias'' node, and the name of the module is put as the value of a node labelled ''modulename''. David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Tue, Jun 9, 2009 at 6:54 PM, David Lutterkort <lutter@redhat.com> wrote:> > On Tue, 2009-06-09 at 11:57 -0400, Bryan Kearney wrote: > > Ok.. lets try this (lutter knows this voodoo better) > > It''s not voodoo, it''s XPath ;) > > > "match *[alias =''usb-storage''] size = 0 " > > That almost works, though shouldn''t that second ''='' be ''=='' ? (and maybe > we should make the augeas provider use ''='' there, too, for consistency) > > I would write this as > > augeas { "usb-storage": > context => "/files/etc/modprobe.conf", > changes => [ "set alias[last()+1] usb-storage", > "set alias[last()]/modulename off", > ], > onlyif => "match alias[.=''usb-storage''] size == 0'' > } > > The fact that the modprobe.conf format is ''command args'' with differing > meanings of the args for the various commands doesn''t matter too much - > it just leads to different tree structures for those commands. For > example for the command ''alias NAME MODULE'' the tree structure is > > alias = ''NAME'' > modulename = ''MODULE'' > > IOW, the name of the alias becomes the value of the ''alias'' node, and > the name of the module is put as the value of a node labelled > ''modulename''. > > David > > > That doesn''t quite work either:### print /files/etc/modprobe.conf ... /files/etc/modprobe.conf/alias[5] = "usb-storage" /files/etc/modprobe.conf/alias[5]/modulename = "off" augtool> match /files/etc/modprobe.conf/alias[=''usb-storage''] (error matching /files/etc/modprobe.conf/alias[=''usb-storage'']) augtool> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
lance dillon wrote:> O >> >> That doesn''t quite work either: > > ### print /files/etc/modprobe.conf > ... > /files/etc/modprobe.conf/alias[5] = "usb-storage" > /files/etc/modprobe.conf/alias[5]/modulename = "off" > augtool> match /files/etc/modprobe.conf/alias[=''usb-storage''] > (error matching /files/etc/modprobe.conf/alias[=''usb-storage'']) > augtool>I believe you need /files/etc/modprobe.conf/alias[.=''usb-storage''] --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Wed, Jun 10, 2009 at 9:15 AM, Bryan Kearney <bkearney@redhat.com> wrote:> > lance dillon wrote: > > O > >> > >> That doesn''t quite work either: > > > > ### print /files/etc/modprobe.conf > > ... > > /files/etc/modprobe.conf/alias[5] = "usb-storage" > > /files/etc/modprobe.conf/alias[5]/modulename = "off" > > augtool> match /files/etc/modprobe.conf/alias[=''usb-storage''] > > (error matching /files/etc/modprobe.conf/alias[=''usb-storage'']) > > augtool> > > > I believe you need > > /files/etc/modprobe.conf/alias[.=''usb-storage''] >That did it. Thanks for the help guys. That was exactly what I needed. -lsd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---