Changeset 295


Ignore:
Timestamp:
Jul 18, 2018, 11:51:42 AM (6 years ago)
Author:
g7moreau
Message:
  • Small change in show command
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ddt/ddt

    r294 r295  
    22682268      next if $domainset_current eq 'version';
    22692269
    2270       print "\n# *** List of computers without IP in the domain set: $domainset_current ***\n";
     2270      print "\n# *** List of pool computers in the domain set: $domainset_current ***\n";
    22712271      printf "%-30s  %-20s %17s %5s %7s %-10s %s\n",
    22722272         'Hostname',
     
    22822282      for my $computer (@domainsetdb) {
    22832283         my ($mac_address, $attribute) = %{$computer};
    2284 
    2285          if ($attribute->{'ip'} =~ m/$DDT::RE::IPv4_ADDRESS/xms) {
    2286             if ( not exists $ipdb{ $attribute->{'ip'} } ) {
    2287                $ipdb{ $attribute->{'ip'} } = {
     2284         my $ip = $attribute->{'ip'};
     2285
     2286         if ($ip =~ m/$DDT::RE::IPv4_ADDRESS/xms) {
     2287            if ( not exists $ipdb{$ip} ) {
     2288               $ipdb{$ip} = {
    22882289                  'mac_address'  => $mac_address,
    22892290                  %{$attribute},
    2290                   'domain'       => $domainset_current,
     2291                  'domainset'    => $domainset_current,
    22912292                  };
    22922293               next LOOP_ON_COMPUTER;
    22932294               }
    22942295            else {
    2295                print {*STDERR} "# Warning: $attribute->{'ip'} already exists in the database !\n";
     2296               print {*STDERR} "# Warning: $ip already exists in the database !\n";
    22962297               }
    22972298            }
     
    23052306         $comment =~ s/^\d\d\d\d-\d\d-\d\d\s//;
    23062307
    2307          my $ip = $attribute->{'ip'};
    2308 
    23092308         my $enable = $attribute->{'enabled'};
    23102309         if (exists $attribute->{'pxe_config'}) {
    23112310            $enable .= '/' . $attribute->{'pxe_config'};
    23122311            }
    2313          if (exists $ipdb{$ip}->{'tag'}) {
    2314             $enable .= ':' . $ipdb{$ip}->{'tag'};
     2312         if (exists $attribute->{'tag'}) {
     2313            $enable .= ':' . $attribute->{'tag'};
    23152314            }
    23162315
     
    23462345
    23472346      printf "%-30s %-20s %17s %9s %3s %10s %s\n",
    2348          $ipdb{$ip}->{'hostname'} . '.' . $ipdb{$ip}->{'domain'},
     2347         $ipdb{$ip}->{'hostname'} . '.' . $ipdb{$ip}->{'domainset'},
    23492348         $ip,
    23502349         normalize_mac_address($ipdb{$ip}->{'mac_address'}),
Note: See TracChangeset for help on using the changeset viewer.