Forum Discussion

samt_81209's avatar
samt_81209
Icon for Nimbostratus rankNimbostratus
Aug 21, 2007

toggleNodeAddress.pl enable/disable

I need some help with the toggleNodeAddress.pl script for my environment. Instead of toggling the state of a node from enabled to disabled, I would like to set the state of the node to enabled/disabled. The reason for this change is I need to pull a node from the F5 when apache stops for code deploys. I would like to run this script, then when all the active connections died off, stop apache in order to upgrade the code. Here is the code that I would need help with.

 

 

 

 

----------------------------------------------------------------

 

Set the state to be toggled to.

 

----------------------------------------------------------------

 

if ( "STATE_ENABLED" eq $enabled_state )

 

{

 

$toggleState = "STATE_DISABLED";

 

}

 

else

 

{

 

$toggleState = "STATE_ENABLED";

 

}

 

 

----------------------------------------------------------------

 

Toggle the State

 

----------------------------------------------------------------

 

$soapResponse =

 

$NodeAddress->set_session_enabled_state

 

(

 

SOAP::Data->name(node_addresses => [$sNode]),

 

SOAP::Data->name(states => [$toggleState])

 

);

 

&checkResponse($soapResponse);

 

------------------------------------------------------------

 

  • I guess I don't understand your question. If all you want to do is to set the state of the node, remove the query component of the script that determines the current state and just hard code the new state to whatever is passed in on the command line. So, if you want the node disabled make the value of $toggleState be "STATE_DISABLED" and make the call to set_session_enabled_state().

     

     

    Maybe I'm missing something... Please clarify if this does not address your issue.

     

     

    -Joe