Ignore:
Timestamp:
2013-06-10T16:32:41+12:00 (11 years ago)
Author:
jmt12
Message:

Ensure Thrift will, be default, attempt to connect to the local machine (by proper name, and only localhost if nothing else is found) and also allow a configuration file to contain only a port number (by just going having:<empty_string><colon><number>)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/perllib/FileUtils/HDThriftFS.pm

    r27568 r27591  
    7373
    7474# Configuration
    75 my $host = "localhost";
     75my $host = (`hostname -s` || `hostname -a` || `hostname` || $ENV{'HOSTNAME'} || 'localhost');
     76chomp($host);
    7677my $port = 58660;
    7778my $debug = 0;
     
    124125      print " * Found Thrift configuration file:\n";
    125126      my $conf_raw = &FileUtils::fileGetContents($conf_file_path);
    126       if ($conf_raw =~ /^([^:]+):(\d+)/)
    127       {
    128         $host = $1;
    129         print " - Host: " . $host . "\n";
     127      if ($conf_raw =~ /^([^:]*):(\d+)/)
     128      {
     129        my $new_host = $1;
    130130        $port = $2;
     131        if ($new_host ne '' && $new_host ne 'localhost')
     132        {
     133          $host = $new_host;
     134          print " - Host: " . $host . "\n";
     135        }
    131136        print " - Port: " . $port . "\n";
    132137      }
Note: See TracChangeset for help on using the changeset viewer.