[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] Augeas config help



> 
> You'll therefore need to make sure that comment does not match
> commented-out settings by changing it to something (untested) like
> 
>         let comment     = 
>           let settings = /MOUNTD_PORT|LOCKD_TCPPORT|.../ in
>           let line_re = /([^ \t\n][^\n]*)?/ - (settings . /[ \t]*=[
> \t]*.*/) in
>           [ label "#comment" . del /#[ \t]*/ "# " .  store line_re .
> del /\n/ "\n" ]
> 
> The important bit is the line_re which will match anything on a
> comment

I've altered the lenses, however, when running through augtool all i see is :

#comment[30] = Port rpc.mountd should listen on.
#comment[31] = MOUNTD_PORT=892
#comment[32] = Optional arguments passed to rpc.statd. See rpc.statd(8)
#comment[33] = STATDARG=""
#comment[34] = Port rpc.statd should listen on.
#comment[35] = STATD_PORT=662

The settings within the comment are not matched and the node after the commented settings does not seem to be showing up.

I attempted to change int_entry regex to something like

   let marker = [ del /#.*/ "# " . label "commented" ] in

however, it is still causing an error of duplicate matched entries.

any thoughts?

(* /etc/sysconfig/nfs - nfs server settings *)

module NFSserver =
    autoload xfm
   
    let eol             = del /[ \t]*\n/ "\n"
    let value_sep       = del /[ \t]*=[ \t]*/  " = "
    let indent          = del /[ \t]*/ ""
    let empty           = [ label "#empty" . eol ]
    
    let comment         =
        let settings    = /RQUOTAD_PORT|LOCKD_TCPPORT|LOCKD_UDPPORT|MOUNTD_PORT|STATD_PORT/ in
        let line_re     = /([^ \t\n][^\n]*)?/ - (settings . /[ \t]*=[ \t]*.*/) in
        [ label "#comment" . del /#[ \t]*/ "#" . store line_re . del /\n/ "\n" ]

    let int_val         = store /[0-9]+/
    
    let int_entry (kw:string) = 
        let marker = [ del /#[ \t]*/ "# " . label "commented" ] in
        [ marker? . key kw . value_sep . int_val ]
    
    let mountd_entry    = int_entry "MOUNTD_PORT"
    let lockd_entry     = int_entry "LOCKD_TCPPORT"
                        | int_entry "LOCKD_UDPPORT"
    let statd_entry     = int_entry "STATD_PORT"
    let rquotad_entry   = int_entry "RQUOTAD_PORT"
    
    let entry           = mountd_entry
                        | lockd_entry
                        | statd_entry
                        | rquotad_entry
    
    let record          = indent . entry . eol
    
    let lns             = ( record | comment | empty ) *

    let filter          = incl "/etc/sysconfig/nfs"
                        . Util.stdexcl
              
    let xfm             = transform lns filter

-- 
        __          __                
.-----.|  |_.-----.|  |--.-----.-----.
|__ --||   _|  _  ||    <|  -__|__ --|
|_____||____|_____||__|__|_____|_____|
 .----------------------------------.
(   ajs redhat com || 919.754.4187   )
 `----------------------------------'



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]