Effective December 3, NetApp adopts Microsoft’s Business-to-Customer (B2C) identity management to simplify and provide secure access to NetApp resources.
For accounts that did not pre-register (prior to Dec 3), access to your NetApp data may take up to 1 hour as your legacy NSS ID is synchronized to the new B2C identity.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Software Development Kit (SDK) and API Discussions

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

WCMNETAPP

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

rohancmr

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

Much appreciated 🙂

zulanch

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

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!

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public