Software Development Kit (SDK) and API Discussions

Anyone successfully using the cifs-share-get-iter API?

WCMNETAPP
4,611 Views

Hi

I'm using the "cifs-share-get-iter" to read out various attributes of the CIFS shares we have on a cluster (running 8.2P4) BUT, for the life of me, I cannot see how to get hold of the items within the "share-properties" section. An example of the XML is:

<cifs-share>

  <share-name>SOMESHARE</share-name>

  <share-properties>

    <cifs-share-properties>oplocks</cifs-share-properties>

    <cifs-share-properties>browsable</cifs-share-properties>

    <cifs-share-properties>changenotify</cifs-share-properties>

  </share-properties>

</cifs-share>

The problem seems to be that the child nodes of "share-properties" all have the same "name" (which I don't recall seeing in other "chapters" of the APIs). If I write some Python such as:

for share in result.child_get('attributes-list').children_get():

  print share.sprintf()

  share_props = share.child_get('share-properties')

  for p in share_props.children_get():

    print p.sprintf()

then (given the above XML), I correctly iterate 3 times round the inner loop and the print statement does as you would expect. How though, do I grab the "value" of each property?

Any ideas, please, anyone?

Regards,

Richard Hellier.

3 REPLIES 3

zulanch
4,610 Views

Hi Richard,

I've run into the same problem. It's an oversight in the Python SDK. The only way to access the value is through the internal data structure of NaElement, like so:

for p in share_props.children_get():

    value = p.element['content']

    print value

-Ben

WCMNETAPP
4,607 Views

Ben,

Many, many thanks for the solution. Glad to know it wasn't "user error" in this case but rather an SDK glitch.

Regards,

Richard.

PS: I won't show the horrible code I had to use as a work around!

rohancmr
3,505 Views

Thankyou...Was really struggling to get this issue resolved.

Much appreciated 🙂

Public