[rancid] supermicro switch (again)
Marcin Dulak
marcin.dulak at gmail.com
Mon Nov 21 09:26:25 UTC 2016
On Mon, Nov 21, 2016 at 7:35 AM, heasley <heas at shrubbery.net> wrote:
> Thu, Nov 17, 2016 at 02:12:31PM +0100, Marcin Dulak:
> > Now, most of the posts suggest that the reason for getting "End of run
> not
> > found" is that rancid does not recognize
> > when the session to the switch is terminated. On Supermicro that seems to
> > be "supermicro-switch#exit".
>
> That is
> if (!$clean_run || !$found_end) {
> if !(command failure or undefined function or unexpected command or end of
> session missing)
> or
> !(found end of the config)
>
> > I'm trying to find out the workflow of rancid in order to make the
> > adjustments:
> >
> > $ grep '#exit\$' usr/share/perl5/vendor_perl/rancid/*
> > usr/share/perl5/vendor_perl/rancid/edgemax.pm: if (/\#exit$/) {
> > usr/share/perl5/vendor_perl/rancid/foundry.pm: if (/\#exit$/) {
> >
> > $ grep '#exit\$' usr/libexec/rancid/*
> > usr/libexec/rancid/rrancid: if (/\#exit$/) {
> >
> > First question: what is the purpose of usr/libexec/rancid/rrancid
> compared
> > to the perl modules under usr/share/perl5/vendor_perl/rancid?
>
> rancid is function used by some (eventually all) of the rancid modules.
> rrancid is the redback module.
>
> > Second question - I'm doing:
> >
> > $ cat etc/rancid/rancid.types.conf
> > supermicro;script;rrancid
> > supermicro;login;smlogin
> > supermicro;inloop;edgemax::inloop
> > supermicro;command;edgemax::ShowVersion;show version
> >
> > but I can see that there seem to be no effect due to what I write for
> some
> > of these options, e.g. I can do without errors:
> > supermicro;script;dummy
> > supermicro;login;smlogin
> > supermicro;inloop;dummy::inloop
> >
> > I would imagine something like that would be caught by rancid
> configuration
> > parser as incorrect and prevent the run?
>
> how would it know until it tries to import the module? I did add recently
> for 3.6:
>
> rancid.pm: check for existence of functions for given device type
> after
> loading the modules for the type. return failure if any are
> missing.
>
> > Adding debug prints to the check for completness in
> > usr/libexec/rancid/rancid (also suggested in some posts) is not helpful:
> > printf(STDERR "$host: missed cmd(s): all commands\n");
> > printf(STDERR "$host: $clean_run\n");
> > printf(STDERR "$host: $found_end\n");
> >
> > $ rancid -d -t supermicro supermicro-switch
> > loadtype: device type supermicro
> > loadtype: found device type supermicro in ./etc/rancid/rancid.types.conf
> > executing smlogin -t 90 -c"show version" supermicro-switch
>
> split it into pieces;
>
> eval `rancid -C -t supermicro supermicro-switch` >output
>
this works.
>
> make sure that works. then work on the module
>
naively I do:
cp usr/share/perl5/vendor_perl/rancid/edgemax.pm
usr/share/perl5/vendor_perl/rancid/supermicro.pm
change "package supermicro;" on the top and add a print STDERR ("I'm
here"); to ShowVersion,
but "I'm here" does no appear in the output of:
$ rancid -d -t supermicro supermicro-switch
This goes back to my question: what gets executed when I replace
"supermicro::" with "dummy::" in
$ cat ./etc/rancid/rancid.types.conf
supermicro;script;rancid
supermicro;login;smlogin
supermicro;inloop;supermicro::inloop
supermicro;command;supermicro::ShowVersion;show version
Marcin
>
> rancid -d -t supermicro -f output
>
> > supermicro-switch: missed cmd(s): all commands
> > supermicro-switch: 0
> > supermicro-switch: 0
> > supermicro-switch: End of run not found
> >
> > Marcin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20161121/ac43fa5f/attachment.html>
More information about the Rancid-discuss
mailing list