Commit b5e208e2 authored by David Johnson's avatar David Johnson

Add a function to return the name of the event server -- when we start

evproxy, we assume "event-server", which doesn't work so well on remote
nodes.  So, look for an eventserver file in any of the standard client
side locations (i.e., /etc/emulab); else, assume "event-server" and
extract the domain from bossname.
parent 5cc03c0e
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
package libtestbed; package libtestbed;
use Exporter; use Exporter;
@ISA = "Exporter"; @ISA = "Exporter";
@EXPORT = qw( TB_BOSSNODE ); @EXPORT = qw( TB_BOSSNODE TB_EVENTSERVER );
# Must come after package declaration! # Must come after package declaration!
use English; use English;
...@@ -43,5 +43,36 @@ sub TB_BOSSNODE() ...@@ -43,5 +43,36 @@ sub TB_BOSSNODE()
return tmccbossname(); return tmccbossname();
} }
#
# Return name of the event server.
#
sub TB_EVENTSERVER()
{
# duplicate behavior of tmcc bossinfo function
my @searchdirs = ( "/etc/testbed","/etc/emulab","/etc/rc.d/testbed",
"/usr/local/etc/testbed","/usr/local/etc/emulab" );
my $bossnode = TB_BOSSNODE();
my $eventserver = '';
foreach my $d (@searchdirs) {
if (-e "$d/eventserver" && !(-z "$d/eventserver")) {
$eventserver = `cat $d/eventserver`;
last;
}
}
if ($eventserver eq '') {
my @ds = split(/\./,$bossnode,2);
if (scalar(@ds) == 2) {
# XXX event-server hardcode
$eventserver = "event-server.$ds[1]";
}
}
if ($eventserver eq '') {
$eventserver = "event-server";
}
return $eventserver;
}
1; 1;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment