Forum Discussion

mhite_60883's avatar
mhite_60883
Icon for Cirrocumulus rankCirrocumulus
Jan 30, 2012

Trouble passing output of LocalLB.Pool.get_member_v2() to members parameter of LocalLB.Pool.get_member_object_status()

Hello,

 

 

 

When I try to run this:

 

 

 

pool_members = b.LocalLB.Pool.get_member_v2(pool_names=[pool])

 

print pool_members

 

pool_members_status = b.LocalLB.Pool.get_member_object_status(pool_names=[pool], members=pool_members)

 

 

 

 

I get this error:

 

 

 

[[(Common.AddressPort){

 

address = "/test-failover/10.81.192.178"

 

port = 80

 

}]]

 

No handlers could be found for logger "suds.client"

 

Server raised fault: 'Could not find element by name: address'

 

 

 

 

LocalLB.Pool.get_member_v2 returns a sequence of sequence AddressPort. Similarly, the members parameter of LocalLB.Pool.get_member_object_status is supposed to take a sequence of sequence AddressPort as a parameter. You can see that the structure looks good from my debug print statement. Any idea where it would be complaining about not being able to find the address element in the AddressPort data structure? This should be a no-brainer: I should be able to pass the output of get_member_v2 right into get_member_object_status...

 

 

 

9 Replies

  • Here is debug off the LB:

     

     

    Jan 30 20:02:01 xyz debug iControlPortal.cgi[31410]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

    Jan 30 20:02:01 xyz debug iControlPortal.cgi[31410]: LocalLB:Pool::get_member_v2 called by user "foo"

     

    Jan 30 20:02:01 xyz debug iControlPortal.cgi[31410]: LocalLB: [0] Pool: /test-failover/test-failover-pool

     

    Jan 30 20:02:01 xyz debug iControlPortal.cgi[31410]: LocalLB:+++++++++++++++new+++++++++++++++++++

     

    Jan 30 20:02:01 xyz debug iControlPortal.cgi[31410]: tpc:in GI::GetProto for name Common::AddressPort_SEQ, factory ptr is 58b70d5c (tag is 0)

     

    Jan 30 20:02:01 xyz debug iControlPortal.cgi[31410]: tpc:lookup result for name Common::AddressPort_SEQ, my ptr 87c1d58
  • The signature for the method is:

    ObjectStatus [] [] get_member_object_status(
        in String [] pool_names,
        in Common__AddressPort [] [] members
    );

    From the looks of your method call, it looks like the members parameter you are passing in is just a 1-D array. Maybe surrounding it with another set of brackets may help coercing it into a 2-D array.

    I can help you with almost any other language, but me and Python just don't get along very well..

    -Joe

  • Hmmm. My method call is just passing what was returned by get_member_v2, which is supposed to be a AddressPortSeqSeq.

     

     

    The [[ ]] around AddressPort would indicate it is a two-dimensional array:

     

     

    [[(Common.AddressPort){

     

    address = "/test-failover/10.81.192.178"

     

    port = 80

     

    }]]

     

     

    If I address it by pool_members[0][0].address (in the python interpreter) I am able to address the element.

     

     

    Just doesn't seem like it is encapsulated in the right typefactory type. It's almost like I need to pull it all apart, iterate through it, and re-typefactory everything using typefactory.create('Common.AddressPortSequence') and stuffing that inside typefactory.create('Common.AddressPortSequenceSequence').

     

     

    Seems rather laborious though...

     

     

    ...

     

     

    So I actually went ahead and tested the aforementioned theory and it does seem to be the only way to get the data into the format the get_member_object_status is happy with...
  • How would one populate an AddressPortSequenceSequence manually?

     

     

    Normally I've used typefactory to create an AddressPortSequence. Then I set that object's "item" element equal to an AddressPort. I then take that AddressPortSequence object and assign it to the "item" element of an AddressPortSequenceSequence. What I can't figure out how to do is provide more than AddressPort in the AddressPortSequence. (Just assigning the AddressPortSequenceSequence.item = [somearray of AddressPorts] doesn't work since we really need a typefactory created AddressPortSequence assigned to AddressPortSequenceSequence.item)
  • Holy heck I figured it out. I'm in my own private typefactory hell, don't mind me.

     

     

    You assign the an array to AddressPortSequence.item. Then you assign AssignPortSequence to AddressPortSequenceSequence.item.
  • Holy heck I figured it out. I'm in my own private typefactory hell, don't mind me.

     

     

    You assign an array to AddressPortSequence.item. Then you assign AssignPortSequence to AddressPortSequenceSequence.item.
  • Mhite: glad you got it figured out. That item [] array is an annoyance for SequenceSequence objects, but is the way Suds wants you to do it. Thanks for posting your findings, hopefully it'll help.

     

     

    As a side note: some of the time your original idea of just passing in [[ ]] will work. I say some of the time because the Suds factory will figure out if there are nested dependencies - if so, you need to use the type factory. If not, you can often pass in native python structures. That said, I always prefer to use the type factory...
  • Mhite: glad you got it figured out. That item [] array is an annoyance for SequenceSequence objects, but is the way Suds wants you to do it. Thanks for posting your findings, hopefully it'll help.

     

     

    As a side note: some of the time your original idea of just passing in [[ ]] will work. I say some of the time because the Suds factory will figure out if there are nested dependencies - if so, you need to use the type factory. If not, you can often pass in native python structures. That said, I always prefer to use the type factory...

     

     

    --Matt
  • Yeah, it really makes my head want to implode. Kind of sucks getting stuck on creating the data structure... :( But it is what it is...

     

     

    Maybe we'll get a REST API with JSON support one day... lol ;)