Changeset d56b168 for fedkit


Ignore:
Timestamp:
May 24, 2010 9:23:51 AM (15 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
301e941
Parents:
8fc0606
Message:

more general namespace manipulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/federate.pl

    r8fc0606 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}
Note: See TracChangeset for help on using the changeset viewer.