- Timestamp:
- Aug 28, 2018, 3:07:40 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ddt/ddt
r332 r333 1133 1133 1134 1134 if ($attribute->{'enabled'} eq 'no') { 1135 print "Info: Host $hostname from domain set $domainset is already disable [OK]" .1135 print "Info: host $hostname from domain set $domainset is already disable [OK]" . 1136 1136 " ... Status: $attribute->{'enabled'}\n"; 1137 1137 exit; … … 1156 1156 my $computer_db = ipamdb_load($COMPUTER_YAML); 1157 1157 1158 my $computer_index;1159 1158 if ( control_exist_mac($computer_db, $mac) == 1 ) { 1160 1159 die "Error: unkown physical MAC address: $mac [FAILED]\n"; … … 1177 1176 if ($attribute->{'ip'} eq $pool) { 1178 1177 if ($attribute->{'enabled'} eq 'no') { 1179 print "Info: Host $mac from pool $pool is already disable [OK]" .1178 print "Info: host $mac from pool $pool is already disable [OK]" . 1180 1179 " ... Status: $attribute->{'enabled'}\n"; 1181 1180 exit; … … 1185 1184 $attribute->{'enabled'} = 'no'; 1186 1185 ipamdb_save("$COMPUTER_YAML", $computer_db); 1187 print "Info: Disabling host $mac from pool $pool [OK]" .1186 print "Info: disabling host $mac from pool $pool [OK]" . 1188 1187 " ... Status: $attribute->{'enabled'}\n"; 1189 1188 exit; … … 1262 1261 1263 1262 if ($attribute->{'enabled'} eq 'yes') { 1264 print "Info: Host $hostname belongs to domain set $domainset is already enable [OK]" .1263 print "Info: host $hostname belongs to domain set $domainset is already enable [OK]" . 1265 1264 " ... Status: $attribute->{'enabled'}\n"; 1266 1265 exit; … … 1271 1270 $attribute->{'enabled'} = 'yes'; 1272 1271 ipamdb_save("$COMPUTER_YAML", $computer_db); 1273 print "Info: Host $hostname is now enable [OK]" .1272 print "Info: host $hostname is now enable [OK]" . 1274 1273 " ... Status: $attribute->{'enabled'}\n"; 1275 1274 exit; … … 1309 1308 1310 1309 if ($attribute->{'enabled'} eq 'yes') { 1311 print "Info: Host $mac from pool $pool is already enable [OK]" .1310 print "Info: host $mac from pool $pool is already enable [OK]" . 1312 1311 " ... Status: $attribute->{'enabled'}\n"; 1313 1312 exit; … … 1450 1449 splice(@{$computer_db->{$domainset}}, $computer_index => 1); 1451 1450 ipamdb_save("$COMPUTER_YAML", $computer_db); 1452 print "Info: Host $ip has been removed from the domain set $domainset [OK]\n";1451 print "Info: host $ip has been removed from the domain set $domainset [OK]\n"; 1453 1452 exit; 1454 1453 } … … 1474 1473 splice(@{$computer_db->{$domainset}}, $computer_index => 1); 1475 1474 ipamdb_save("$COMPUTER_YAML", $computer_db); 1476 print "Info: Host $hostname has been removed from the domain set $domainset [OK]\n";1475 print "Info: host $hostname has been removed from the domain set $domainset [OK]\n"; 1477 1476 exit; 1478 1477 } … … 1869 1868 next if $domainset_current eq 'version'; 1870 1869 1871 my $computer_index = 0;1870 LOOP_ON_COMPUTER: 1872 1871 for my $computer (@{$computer_db->{$domainset_current}}) { 1873 for my $id (keys %{$computer}) { 1874 if ($computer->{$id}->{'ip'} eq $ip) { 1875 my $timestamp = time; 1876 $computer_db->{$domainset_current}[$computer_index]->{$id}->{'modify_time'} = $timestamp; 1877 $computer_db->{$domainset_current}[$computer_index]->{$id}->{'pxe_config'} = $pxe_config; 1878 print "IP address: $ip, PXE enabled in config: $pxe_config\n"; 1879 ipamdb_save("$COMPUTER_YAML", $computer_db); 1880 exit; 1881 } 1882 $computer_index++; 1883 } 1872 my ($mac_address, $attribute) = %{$computer}; 1873 next LOOP_ON_COMPUTER if $attribute->{'ip'} ne $ip; 1874 1875 $attribute->{'modify_time'} = time; 1876 $attribute->{'pxe_config'} = $pxe_config; 1877 ipamdb_save("$COMPUTER_YAML", $computer_db); 1878 print "Info: host $attribute->{'hostname'} ($domainset_current), IP $ip, PXE enabled: $pxe_config\n"; 1879 exit; 1884 1880 } 1885 1881 } … … 1902 1898 $attribute->{'pxe_config'} = $pxe_config; 1903 1899 ipamdb_save("$COMPUTER_YAML", $computer_db); 1904 print "Info: Host $hostname ($domainset), PXE enabled in config: $pxe_config [OK]\n";1900 print "Info: host $hostname ($domainset), IP $attribute->{'ip'}, PXE enabled: $pxe_config [OK]\n"; 1905 1901 exit; 1906 1902 } … … 1985 1981 delete $attribute->{'pxe_config'}; 1986 1982 ipamdb_save("$COMPUTER_YAML", $computer_db); 1987 print "Info: Host $hostname ($domainset), PXE disable from config: $pxe_config [OK]\n";1983 print "Info: host $hostname ($domainset), PXE disable from config: $pxe_config [OK]\n"; 1988 1984 exit; 1989 1985 }
Note: See TracChangeset
for help on using the changeset viewer.