gerty icon indicating copy to clipboard operation
gerty copied to clipboard

error for config-backup Cisco ASA 5510/5520

Open lionelseydoux opened this issue 12 years ago • 5 comments

Hi, I get an error in the perl Expect.pm file when backuping ASA devices. Any ideas where it comes from?

/opt/gerty/bin/gerty run myjob.ini --debug ... Mar 27 16:43:29 [INFO] Starting 1 device jobs Mar 27 16:43:29 [DEBUG] Retrieved "job.action-handler"="Gerty::CLI::CiscoLike" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "admin-mode"="1" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "cli.timeout"="15" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "cli.user-prompt"="^\S+>" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "cli.admin-prompt"="^\S+#" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "cli.comment-string"="!!!" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "cli.error-regexp"="^%" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "job.output-handler"="Gerty::Output::File" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "output.default-path"="/srv/gerty/output" from siteconfig level Mar 27 16:43:29 [DEBUG] Retrieved "output.failure-suffix"="failure" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "output.success-suffix"="success" from devclass level Mar 27 16:43:29 [DEBUG] Retrieved "output.default-status-path"="/srv/gerty/status" from siteconfig level Mar 27 16:43:29 [DEBUG] Retrieved "output.delete-on-failure"="0" from devclass level Mar 27 16:43:29 [DEBUG] Actions supported for 192.168.216.1: config-backup Mar 27 16:43:29 [DEBUG] Retrieved "do.config-backup"="1" from job level Mar 27 16:43:29 [DEBUG] Retrieved "config-backup.path"="/srv/gerty/config" from job level Mar 27 16:43:29 [DEBUG] Actions enabled for 192.168.216.1: config-backup Mar 27 16:43:29 [DEBUG] Connecting to 192.168.216.1 with telnet Mar 27 16:43:30 [DEBUG] Logged in at 192.168.216.1 Can't use string ("") as a subroutine ref while "strict refs" in use at /usr/share/perl5/Expect.pm line 813.

lionelseydoux avatar Mar 27 '12 14:03 lionelseydoux

I never tested it with ASA. Also probably some of your INI files miss something. If I would get remote access to your server, I could probably diagnose it.

ssinyagin avatar Mar 27 '12 15:03 ssinyagin

Hi,

thanks for you fast answer. I've made some troubleshooting and found which code line generates the errror (line 577 in $GERTYHOME/lib/gerty/perl/Gerty/Job.pm): it never goes out of the call to init()... I first of all thought it was because of the space following the prompt on the ASA: Zug-FWL-01> en Password: ********** Zug-FWL-01# sh run

That's why I tried to modify the regex prompt to accept trailing spaces: cli.user-prompt = ^\S+>\s* cli.admin-prompt = ^\S+#\s*

but I still get the same error I'll see how I can organise a remote access through teamviewer.

best regards,

lionel seydoux

Job.pm:

   ...
    my $acc = $dev->{'ACCESS_HANDLER'};
    my $connect_failure;


    if( not  $acc->connect())
    {
        $connect_failure = {
            'success' => 0,
            'content' => 'Failed to connect to ' . $dev->{'SYSNAME'}
        };
    }
    elsif(not $action_handler->init() )   # <-- this line causes the problem
    {
        $connect_failure = {
            'success' => 0,
            'content' => 'Failed to initialize connection to ' .
                $dev->{'SYSNAME'}
        };
    }
    ...

lionelseydoux avatar Mar 28 '12 11:03 lionelseydoux

Hi stanislav, We can do a teamviewer session whenever you want. you can get it with this link. (I've only go a license for the old  version 5)http://www.teamviewer.com/download/version_5x/TeamViewerQS.exe

regards, lionel seydoux 0583011997 En réponse à Stanislav Sinyagin [email protected] :I never tested it with ASA. Also probably some of your INI files miss something. If I would get remote access to your server, I could probably

diagnose it.

Reply to this email directly or view it on GitHub: https://github.com/ssinyagin/gerty/issues/4#issuecomment-4718457

lionelseydoux avatar Mar 29 '12 08:03 lionelseydoux

This is what I do for Cisco ASA:

commands =<<EOT
    inherit = Gerty.CiscoIOS
    cli.user-prompt = ^.*>
    cli.admin-prompt = ^.*#
    pager-off.command = terminal pager 0
    do.config-backup = 1
    config-backup.exclude =
    +cli.command-actions = show-version, show-inventory
    do.show-version = 1
    show-version.path = ${datapath}/output
    show-version.command = show version | exclude (days)
    do.show-inventory = 1
    show-inventory.path = ${datapath}/output
    show-inventory.command = show inventory
EOT

cbueche avatar Feb 26 '13 13:02 cbueche

please test: https://github.com/ssinyagin/gerty-plugins/commit/4f8addfb084f5fa2dbfe126d8a07a17597bb0f22

ssinyagin avatar Mar 22 '13 22:03 ssinyagin