[rancid] Re: JRancid show config | display set
Árni Birgisson
abirgisson at fattoc.com
Fri Oct 30 10:30:20 UTC 2009
Here you go.
This is a replacement for /usr/libexec/rancid/jrancid
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jrancid.gz
Type: application/x-gzip
Size: 5521 bytes
Desc: not available
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20091030/51a41eb5/attachment.bin
-------------- next part --------------
Diff:
416a417,439
> # This routine parses "show configuration | display set | no-more"
> sub ShowConfigurationDisplaySet {
> print STDERR " In ShowConfigurationDisplaySet: $_" if
($debug);
>
> s/^[a-z]+@//;
> ProcessHistory("","","","# $_");
> while (<INPUT>) {
> tr/\015//d;
> last if (/^$prompt/);
> next if (/^system (shutdown message from|going down )/i);
> next if (/^\{(master|backup)}/);
>
> /Unrecognized command/ && return;
> /command is not valid/ && return;
> /^\s+\^/ && return;
> /syntax error/ && return;
>
> ProcessHistory("","","","$_");
> }
> return(0);
> }
>
>
638a662
> {'show configuration | display set | no-more' =>
'ShowConfigurationDisplaySet'},
666c690,691
< $cmds_regexp=join("|", at commands);
---
> $cmds_regexp = join("|", map quotemeta($_), @commands);
> #$cmds_regexp=join("|", at commands);
- Arni
On Oct 30, 2009, at 10:14 AM, I?aki Martinez Diez wrote:
> ?rni Birgisson escribi?:
>> You sir, are awesome :-)
>>
>> This works like a charm.
>>
>> For anyone else thinking about doing the same my changes include:
>> * The changes from jeremy
>> * adding a new parser called ShowConfigurationDisplaySet (copied
>> from some other simple parser)
>> * adding a command to the commandtable "show configuration |
>> display set | no-more" => 'ShowConfigurationDisplaySet'.
>>
>
> Can you attach the complete file i am interested, thank you.
>
Arni Birgisson
Network Engineer
FATTOC Iceland
Adalstraeti 6
101 Reykjavik
Iceland
More information about the Rancid-discuss
mailing list