Ignore:
Timestamp:
02/27/08 09:45:45 (16 years ago)
Author:
bastiaans
Message:

libtoga.php:

  • rearranged domain code a little for situations without domain name
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/addons/job_monarch/libtoga.php

    r464 r492  
    693693                                        $nr_nodes = count( $jobs[$jobid][nodes] );
    694694               
    695                                         if( $jobs[$jobid][status] == 'R' ) {
    696 
    697                                                 $domain         = $jobs[$jobid][domain];
    698                                                 $domain_len     = 0 - strlen( $domain );
    699 
    700                                                 // Let's see if Ganglia use's FQDN or short hostnames
    701                                                 //
    702                                                 foreach( $nodes as $hostname => $nimage ) {
     695                                        if( $jobs[$jobid][status] == 'R' )
     696                                        {
     697
     698                                                if( isset( $jobs[$jobid][domain] )
     699                                                {
     700                                                        $domain         = $jobs[$jobid][domain];
     701                                                        $domain_len     = 0 - strlen( $domain );
     702
     703                                                        // Let's see if Ganglia use's FQDN or short hostnames
     704                                                        //
     705                                                        foreach( $nodes as $hostname => $nimage )
     706                                                        {
    703707                                       
    704                                                         if( substr( $hostname, $domain_len ) != $domain )
    705                                                         {
    706                                                                 $this->fqdn     = 0;
     708                                                                if( substr( $hostname, $domain_len ) != $domain )
     709                                                                {
     710                                                                        $this->fqdn     = 0;
     711                                                                }
    707712                                                        }
    708713                                                }
     
    712717                                                        // Only add domain name to the hostname if Ganglia is doing that too
    713718                                                        //
    714                                                         if( $this->fqdn )
     719                                                        if( ( $this->fqdn ) && ( isset( $jobs[$jobid][domain] ) )
    715720                                                        {
    716                                                                 if( substr( $node, $domain_len ) != $domain ) {
     721                                                                if( substr( $node, $domain_len ) != $domain )
     722                                                                {
    717723                                                                        $host = $node. '.'.$domain;
    718                                                                 } else {
     724                                                                } else
     725                                                                {
    719726                                                                        $host = $node;
    720727                                                                }
Note: See TracChangeset for help on using the changeset viewer.