- Timestamp:
- Sep 17, 2018, 9:15:05 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ddt/ddt
r366 r367 441 441 #Nom: add_alias 442 442 #Description: ajoute un alias pour une machine. Pour la fonctionnalité CNAME dans le DNS. 443 # Seems not finish and not functional ! 443 444 444 445 sub add_alias { … … 580 581 exit_on_error_option($help) 581 582 if $hostname eq '' 582 or $sector eq ''583 or $sector eq '' 583 584 or $alias eq ''; 584 585 … … 606 607 exit_on_error_option($help) 607 608 if $hostname eq '' 608 or $sector eq ''609 or $sector eq '' 609 610 or $ip eq '' 610 611 or $mac eq '' … … 633 634 exit_on_error_option($help) 634 635 if $pool eq '' 635 or $sector eq ''636 or $sector eq '' 636 637 or $mac eq '' 637 638 or $comment eq ''; … … 642 643 643 644 #------------------------------------------------------------------------------- 645 # No DHCP computer, just an entry A in DNS with a real MAC 644 646 645 647 sub cmd_add_static { … … 660 662 exit_on_error_option($help) 661 663 if $hostname eq '' 662 or $sector eq ''664 or $sector eq '' 663 665 or $ip eq '' 664 666 or $mac eq '' … … 688 690 exit_on_error_option($help) 689 691 if $hostname eq '' 690 or $sector eq ''692 or $sector eq '' 691 693 or $ip eq '' 692 694 or $comment eq ''; … … 705 707 706 708 my $mac = join ':', 'FF', 'FF', map({sprintf("%02X", $_)} split(/\./, $ip)); 707 control_syntax_mac_address($mac) 708 control_exist_mac($computer_db, $mac) 709 control_syntax_mac_address($mac) or exit; 710 control_exist_mac($computer_db, $mac) or die "Error: virtual physical MAC address already exists: $mac\n"; 709 711 710 712 push @{$computer_db->{$sector}}, { $mac => { … … 716 718 'modify_time' => $timestamp, 717 719 'comment' => $comment, 720 'alias' => '', 718 721 }}; 719 722 print "Add the virtual computer: $hostname, IP: $ip, sector: $sector\n"; … … 905 908 exit_on_error_option($help) 906 909 if $hostname eq '' 907 or $sector eq ''910 or $sector eq '' 908 911 or $ip eq ''; 909 912 … … 928 931 exit_on_error_option($help) 929 932 if $hostname eq '' 930 or $sector eq ''933 or $sector eq '' 931 934 or $ip eq ''; 932 935 … … 1120 1123 my $computer_db = ipamdb_load($COMPUTER_YAML); 1121 1124 1122 if ($type !~ m/^ (dhcp|float|static |virtual) $/xms) {1125 if ($type !~ m/^ (dhcp|float|static) $/xms) { 1123 1126 die "Error: bad type: $type\n"; 1124 1127 } … … 1759 1762 exit_on_error_option($help) 1760 1763 if $pool eq '' 1761 or $sector eq ''1764 or $sector eq '' 1762 1765 or $file_pool eq '' 1763 1766 or $ipaddress_pool eq ''; … … 3493 3496 =head2 add-static 3494 3497 3498 Add a static host in the database. 3499 No DHCP configuration will be generated, 3500 only DNS. 3501 3495 3502 ddt add-static [--hostname|-h hostname] [--sector|-s|-d sector] [--ip|-i ip] [--mac|-m mac] [--comment|-c comment] 3496 3503 3497 3504 =head2 add-virtual 3498 3505 3506 Add a static host in the database with a virtual MAC address beginning by C<FF:FF:...>. 3507 No DHCP configuration will be generated, 3508 only DNS. 3509 3499 3510 ddt add-virtual [--hostname|-h hostname] [--sector|-s|-d sector] [--ip|-i ip] [--comment|-c comment] 3500 3511
Note: See TracChangeset
for help on using the changeset viewer.