- Timestamp:
- May 25, 2010 5:42:25 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- b10375f
- Parents:
- 479a7d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/federate.pl
r479a7d9 rd38ff56 24 24 my %services; 25 25 my %aliases; 26 my @added;26 my %added; 27 27 my $perl; 28 28 … … 95 95 /Service:\s+(.*)/i && do { $services{$1}++;}; 96 96 /PortalAlias:\s+(.*)/i && do { $aliases{$1}++;}; 97 /AddedNode:\s+(.*)/i && do { push(@added, $1); }; 98 } 99 100 # If nodes have been added with this name, do not alias the name to the portal 101 for my $a (@added) { 102 chomp $a; 103 delete $aliases{$a} if $aliases{$a}; 97 /AddedNode:\s+(.*)/i && do { $added{$1}++; }; 104 98 } 105 99 $client->close(); … … 123 117 print $new_hosts $_; 124 118 } 119 print $new_hosts "\n"; 125 120 $config_hosts->close(); 126 121 127 122 # Add gateway aliases 128 if (%aliases) { 129 if ( my $hent = gethostbyname($gateway) ) { 130 my $gwip = inet_ntoa($hent->addr_list->[0]); 131 132 for my $k (keys %aliases) { 133 if ($exp && $proj) { 134 print $new_hosts "\n$gwip\t$k.$exp.$proj $k\n"; 135 } 136 else { 137 print $new_hosts "\n$gwip\t$k\n"; 138 } 139 } 140 } 123 for my $k (keys %aliases) { 124 # If we added a node, it's a node without a local address. Bind the name 125 # to the IP in /etc/hosts. If we didn't add a node, it's the gateway node. 126 (my $lname = $gateway) =~ s/^[^\.]+/$k/; 127 my $ip = gateway_lib::get_ip($added{$k} ? $lname : $gateway); 128 if ($ip) { 129 # We have an IP. Make a hosts entry for teh key and the key plus the 130 # first two subdomains (which is an emulab setup) 131 my @x = split(/\./, $lname); 132 if (@x > 3 ) { splice(@x, 3); } 133 my $out = join(".", @x); 134 print $new_hosts "$ip\t$out $k\n"; 135 } 136 else { print $new_hosts "# Can't get ip for $lname\n"; } 141 137 } 142 138 $new_hosts->close();
Note: See TracChangeset
for help on using the changeset viewer.