[rancid] help request after I developed new module 'vnxrancid', but it don't save output properly to configs directory
danielc at vmware.com
danielc at vmware.com
Sat Sep 17 17:43:59 UTC 2011
I backtracked my changes to which part of the changes caused the rancid-run to fail.
I think I broke my variation of the fnrancid when I attempted to get the prompt to be recognized.
As stand-alone, vnxrancid -d vnx01 appear to be able to generate the vnx01.raw and vnx01.new files when NOPIPE=yes was engaged.
The prompt looks like the following during a ssh:
[nasadmin at r2778-vnx01cs0 ~]$
In looking at the .raw file, it looks like a there is an escape sequence:
^[]0;nasadmin at r2778-vnx01cs0:~^G[nasadmin at r2778-vnx01cs0 ~]$ ^M
while (/^.+(#|\$)\s*($cmds_regexp)\s*$/) {
$cmd = $2;
# - FortiGate prompts end with either '#' or '$'. Further, they may
# be prepended with a '~' if the hostname is too long. Therefore,
# we need to figure out what our prompt really is.
# if (!defined($prompt)) {
# if ($_ =~ m/^.+\~\$/) {
# $prompt = '\~\$ .*';
# } else {
# if ($_ =~ m/^.+\$/) {
# $prompt = ' \$ .*';
# } else {
# if ($_ =~ m/^.+\~#/) {
# $prompt = '\~# .*';
# } else {
# if ($_ =~ m/^.+#/) {
# $prompt = ' # .*';
# }
# }
# }
# }
# }
print STDERR ("line:$_\ncmd:$2\n") if ($debug);
if (!defined($prompt)) {
print STDERR ("PROMPT0 MATCH: $1\n") if ($debug);
# $prompt = ($_ =~ /^([^#]+#)/)[0];
$prompt = ($_ =~ /^([^\$]+\$)/)[0];
print STDERR ("PROMPT1 MATCH: $prompt\n") if ($debug);
# $prompt =~ s/([][}{)(\\])/\\$1/g;
print STDERR ("PROMPT2 MATCH: $prompt\n") if ($debug);
# $prompt =~ s/[\$]//g;
print STDERR ("PROMPT3 MATCH: $prompt\n") if ($debug);
}
Regards,
Daniel Chen
----- Original Message -----
From: danielc at vmware.com
To: rancid-discuss at shrubbery.net
Sent: Saturday, September 17, 2011 8:35:38 AM
Subject: Re: [rancid] help request after I developed new module 'vnxrancid', but it don't save output properly to configs directory
Nevermind.
I used ProcessHistory("","","","","!field:$_");
so all the lines in the .new are practically comments as there is no "configuration" to capture as such.
I think that would be it. Trying now.
Sorry,
Daniel Chen
----- Original Message -----
From: danielc at vmware.com
To: rancid-discuss at shrubbery.net
Sent: Saturday, September 17, 2011 7:56:04 AM
Subject: [rancid] help request after I developed new module 'vnxrancid', but it don't save output properly to configs directory
I hacked fnlogin/fnrancid pair to do some EMC VNX commands on their RHAT/Linux shell, but the only a portion of the output is not being checked into the configs directory.
I have done the following:
NOPIPE=yes;export NOPIPE
vnxrancid -d vnx01
I get the two files: vnx01.raw and vnx01.new
But if I do just:
rancid-run -r vnx01 testing
The .../var/testing/configs/vnx01 file only has saved some lines like:
!RANCID-CONTENT-TYPE: vnxrancid
The contents of the vnx01.new file looks perfect (in my opinion)
I noticed that the end of the vnx01.raw file still have lots of control characters, is this interfering with the rancid-run
^M
^[]0;nasadmin at r2778-vnx01cs0:~^G[nasadmin at r2778-vnx01cs0 ~]$ ^M
^[]0;nasadmin at r2778-vnx01cs0:~^G[nasadmin at r2778-vnx01cs0 ~]$ exit^M
logout^M
^[[H^[[2JConnection to vnx01 closed.^M^M
whereas an UCS, N7K, Vyatta device the .raw file is much cleaner.
exit^M
r2845-n6k-B#exit^M
Connection to r2845-n6k02 closed.^M^M
commit^M
^[]0;rancidnms at hub-las01-fw01b: ~^G^[[01;32mrancidnms at hub-las01-fw01b^[[00m:^[[01;34m~^[[00m$ ^M
^[]0;rancidnms at hub-las01-fw01b: ~^G^[[01;32mrancidnms at hub-las01-fw01b^[[00m:^[[01;34m~^[[00m$ exit^M
logout^M
Connection to hub-las01-fw01b closed.^M^M
^M
Thanks,
Daniel Chen
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss
More information about the Rancid-discuss
mailing list