Changeset 34


Ignore:
Timestamp:
Feb 11, 2008, 9:11:57 PM (17 years ago)
Author:
g7moreau
Message:
  • Add some check to verify taht the databse exists and if not, propose the good command to do.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/klask

    r33 r34  
    113113   }
    114114
     115sub test_switchdb_environnement {
     116   die "Switch database $KLASK_SW_FILE does not exists. Launch updatesw before this command !\n" if not -e "$KLASK_SW_FILE";
     117   }
     118
     119sub test_maindb_environnement {
     120   die "Main database $KLASK_DB_FILE does not exists. Launch updatedb before this command !\n" if not -e "$KLASK_DB_FILE";
     121   }
     122
    115123###
    116124# fast ping dont l'objectif est de remplir la table arp de la machine
     
    537545      @network = get_list_network() if not @network;
    538546
    539    my $computerdb = YAML::LoadFile("$KLASK_DB_FILE");
     547   test_switchdb_environnement();
     548
     549   my $computerdb = {};
     550      $computerdb = YAML::LoadFile("$KLASK_DB_FILE") if -e "$KLASK_DB_FILE";
    540551   my $timestamp = time;
    541552
     
    708719sub cmd_removedb {
    709720   my @computer = @_;
    710    
     721
     722   test_maindb_environnement();
     723
    711724   my $computerdb = YAML::LoadFile("$KLASK_DB_FILE");
    712725
     
    726739
    727740sub cmd_exportdb {
     741   test_maindb_environnement();
     742
    728743   my $computerdb = YAML::LoadFile("$KLASK_DB_FILE");
    729744
     
    9861001   my @ARGV   = @_;
    9871002
     1003   test_switchdb_environnement();
     1004
    9881005   my $format = 'txt';
    9891006
Note: See TracChangeset for help on using the changeset viewer.