Show
Ignore:
Timestamp:
05/24/10 09:23:51 (2 years ago)
Author:
Ted Faber <faber@…>
Children:
301e9417d1e4c65795af6b69250c30f817bcba86
Parents:
8fc06061ceb968f3ad4b66482b703cad6505bb7a
git-committer:
Ted Faber <faber@isi.edu> / 2010-05-24T16:23:51Z+0000
Message:

more general namespace manipulation

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • fedkit/federate.pl

    rdc803a7 rd56b168  
    2323my $local_config_dir = "/usr/local/federation/etc"; 
    2424my %services; 
     25my %aliases; 
     26my @added; 
    2527my $perl; 
    2628 
     
    9294    /ProjectName:\s+(.*)/i && do { $smbproject = $1; }; 
    9395    /Service:\s+(.*)/i && do { $services{$1}++;}; 
     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 
     101for my $a (@added) { 
     102    chomp $a; 
     103    delete $aliases{$a} if $aliases{$a}; 
    94104} 
    95105$client->close(); 
     
    103113while (<$hosts>) { 
    104114    /^127\.0\.0\.1/ && do { print $new_hosts $_; }; 
    105     /control\./ && $has_control++; 
     115    # If aliases conflict with existing nodes, delete the alias 
     116    for my $n (split($_)) { 
     117        chomp $n; 
     118        delete $aliases{$n} if $aliases{$n}; 
     119    } 
    106120} 
    107121$hosts->close(); 
     
    111125$config_hosts->close(); 
    112126 
    113 # If seer is enabled and no local control node in play, alias the gateway to be 
    114 # control 
     127# Add gateway aliases 
    115128if ($services{'seer'} && !$has_control ) { 
    116129    if ( my $hent = gethostbyname($gateway) ) { 
    117130        my $gwip = inet_ntoa($hent->addr_list->[0]); 
    118131 
    119         print $new_hosts "\n$gwip\tcontrol.$exp.$proj\n"; 
     132        for my $k (keys %aliases) { 
     133            print $new_hosts "\n$gwip\t$k.$exp.$proj\n"; 
     134        } 
    120135    } 
    121136}