Hi José,

I think that some people at engineering are looking into this, but that 
there was a reason for this to be in that order.

I'll let you know if I have an update on this!

Cheers,

On Friday, September 13, 2013 2:21:07 PM UTC+2, José Juan Montes wrote:
>
>
>
> Hi Thomas,
>
> Thanks a lot for the detailed response!
>
> So yes, I ended up using szradmin and processing the result with xpath. 
> I'm happy to see it is a reasonable solution.
>
> As for the solutions, I reckon most people will be interested in the IP 
> list _after_ the event and not _before_. One can always look at the event 
> details (passed as parameters to our custom scripts) in order to find out 
> the particular instance and event, but in many cases I think you just need 
> to list available hosts. Simply knowing this helps (better documentation 
> ;)).
>
> For the record, this is what I use to process szradmin output from Bash:
>
> SERVER_IPS=$( szradm -q list-roles | xpath -e 
> '/response/roles/role[@name="role-im-interested-in"]/hosts/host[@status="Running"]/@internal-ip'
>  
> 2> /dev/null | sed -E 's/\W*internal\-ip="([0-9\.]*)".*/\1/' | grep 
> '[0-9\.]*' )
>
> Thanks and regards!
>
> Hi José,
>>
>> This is indeed something we're aware of, and we're investigating 
>> solutions.
>>
>> In the meantime, what you can do is the following:
>> - Configure your script to asynchronous
>> - Make sure your script runs last on HostUp and HostTerminate (your can 
>> see the order in the Scripting tab)
>> - Start your script by adding a small sleep
>>
>> That's a hack, but it should work: the IP List Builder handler (which 
>> touches the IP files), runs *just* after the last script has run, and 
>> asynchronous execution means you don't wait for the script to exit before 
>> moving on. 
>>
>> I have a tutorial (the code is ready, not the text) where we do exactly 
>> this: 
>> https://github.com/scalr-tutorials/workertier/blob/master/scalr/scripts/workertier.findbackend.sh
>>
>>
>> If you want something more rock solid, you can use `szradm -q 
>> list-roles` in your script. 
>>
>>
>> Cheers,
>>
>> On Thursday, September 12, 2013 8:30:30 PM UTC+2, José Juan Montes wrote:
>>>
>>> Hello.
>>>
>>> I'm trying to configure my own balancer role (using nginx).
>>>
>>> I have a script that uses the information in 
>>> /etc/scalr/private.d/hosts/<my_role> to build nginx configuration, and 
>>> works ok.
>>>
>>> The problem is when I add this script to the "HostUp" and 
>>> "BeforeHostTerminate" events. It is executed _before_ the list of IPs has 
>>> been updated (as I can tell from scalarizr logs). 
>>>
>>> How should I orchestrate this kind of thing?
>>>
>>> Any advice is very welcome.
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"scalr-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to