Changeset 151
- Timestamp:
- Jun 8, 2016, 6:59:53 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/klask
r150 r151 7 7 use strict; 8 8 use warnings; 9 use version; our $VERSION = qv('0.5. 5');9 use version; our $VERSION = qv('0.5.6'); 10 10 11 11 use Readonly; … … 681 681 } 682 682 683 # Load computer database 683 684 sub computerdb_load { 684 685 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE"); 685 686 687 LOOP_ON_IP_ADDRESS: 688 for my $ip (keys %{$computerdb}) { 689 690 next LOOP_ON_IP_ADDRESS if exists $computerdb->{$ip}{switch_port_hr}; 691 692 $computerdb->{$ip}{switch_port_hr} = $computerdb->{$ip}{switch_port}; 693 } 694 686 695 return $computerdb; 687 696 } … … 784 793 785 794 fast_ping(@computer); 786 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");795 my $computerdb = computerdb_load(); 787 796 788 797 LOOP_ON_COMPUTER: … … 812 821 my @mac = map { normalize_mac_address($_) } @_; 813 822 814 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");823 my $computerdb = computerdb_load(); 815 824 816 825 LOOP_ON_MAC: … … 846 855 847 856 my $computerdb = {}; 848 $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE") if -e "$KLASK_DB_FILE";857 $computerdb = computerdb_load() if -e "$KLASK_DB_FILE"; 849 858 my $timestamp = time; 850 859 … … 1020 1029 test_maindb_environnement(); 1021 1030 1022 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");1031 my $computerdb = computerdb_load(); 1023 1032 1024 1033 LOOP_ON_COMPUTER: … … 1163 1172 test_maindb_environnement(); 1164 1173 1165 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");1174 my $computerdb = computerdb_load(); 1166 1175 1167 1176 printf "%-27s %-4s %-40s %-15s %-18s %-16s %s\n", qw(Switch Port Hostname-FQ IPv4-Address MAC-Address Date VLAN); … … 1199 1208 test_maindb_environnement(); 1200 1209 1201 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");1210 my $computerdb = computerdb_load(); 1202 1211 1203 1212 #<link rel="stylesheet" type="text/css" href="style-klask.css" /> … … 1412 1421 test_maindb_environnement(); 1413 1422 1414 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");1423 my $computerdb = computerdb_load(); 1415 1424 1416 1425 # create a database with the most recent computer by switch port … … 1700 1709 1701 1710 sub cmd_ip_location { 1702 my $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE");1711 my $computerdb = computerdb_load(); 1703 1712 1704 1713 LOOP_ON_IP_ADDRESS: … … 1747 1756 1748 1757 my $computerdb = {}; 1749 $computerdb = YAML::Syck::LoadFile("$KLASK_DB_FILE") if -e "$KLASK_DB_FILE";1758 $computerdb = computerdb_load() if -e "$KLASK_DB_FILE"; 1750 1759 my $timestamp = time; 1751 1760
Note: See TracChangeset
for help on using the changeset viewer.