File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -180,8 +180,8 @@ function get_node_ip {
180180        fi 
181181        if  [ -z  " $NODE_ADDR "   ];  then 
182182            NODE_ADDR=" $( grep -e ' ^listen_address: '   " $CONF_DIR /cassandra.yaml"   | sed -e ' s|^[^:]*:[ ]*\([^ ]*\)[ ]*$|\1|' | tr -d " '" ) " 
183-             if  [ -z  " $NODE_ADDR "   ] ||  [ " $NODE_ADDR "   =  " 127.0.0.1"   ] ||  [ " $NODE_ADDR "   =  " localhost"   ];  then 
184-                 #              echo "Can't detect node's address from cassandra.yaml, or it's set to localhost. Trying to use the 'hostname'"
183+             if  [ -z  " $NODE_ADDR "   ] ||  [ " $NODE_ADDR "   =  " 127.0.0.1"   ] ||  [ " $NODE_ADDR "   =  " localhost"   ]  ||  [  $( checkIP  $NODE_ADDR )   =   " false "  ] ;  then 
184+                    echo  " Can't detect node's address from cassandra.yaml, or it's set to localhost. Trying to use the 'hostname'" 
185185                if  [ " $HOST_OS "   =  " Linux"   ];  then 
186186                    NODE_ADDR=" $( hostname -i) " 
187187                else 
@@ -1068,6 +1068,16 @@ function adjust_nodetool_params {
10681068    JMX_OPTS=" $JMX_OPTS  -s $jmx_host :$jmx_port " 
10691069}
10701070
1071+ function  checkIP()  {
1072+ 
1073+   if  [[ $1  =~  ^[0-9]+\. [0-9]+\. [0-9]+\. [0-9]+$ ]];  then 
1074+     echo  " true" 
1075+   else 
1076+     echo  " false" 
1077+   fi 
1078+ 
1079+ }
1080+ 
10711081#  Call functions in order
10721082
10731083debug " Collection mode: $MODE " 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments