Community

Subscribe
Highlighted

NaServer.rb (ruby API) issue?

Dear all,

(Please let me know the right place to discuss this kind of topic since I'm new to join this community site, thank you)

I'm trying to use Ruby API NaServer.rb (and others), which are provided by NetApp Inc, to control NetApp server from our ruby-based application.

When integrating this API to our app, some strange behavior happen on our unit-test.  After removing the portion which uses this API, there is no problem (but of course the app cannot work with NetApp server).  This is apparently something NetApp.rb side-effect.

After our further investigation, we found that there is an issue in the NaServer.rb code as follows:

  ...

  require 'rexml/streamlistener'

  include REXML                           # Here

  require 'stringio'

  include StreamListener                # and Here!

  ...

These two 'include' lines above apparently wrong usage of ruby-lang because 'include' in ruby means to include the module into current namespace so that above two include lines cause overwriting global methods by all of REXML and StreamListener methods.  That's quite danger, I think.  Actually, ActionMailer (or Rspec?, sorry I foregot right now) "comment"  method is overwritten by this so our unit-test failed.

Actually, in this case, 'include' is not necessary.  It should be OK to remove 'include' lines and rewriting lines which uses REXML as follows as one of example:

  Document.parse_stream(xml_response, MyListener.new)

   |

  V

  REXML:Smiley Very Happyocument.parse_stream(xml_response, MyListener.new)

  (NaServer.rb 284-th line as one of example)

Could anyone update NaServer.rb?

Best Regards,

Re: NaServer.rb (ruby API) issue?

Hi,

Thanks for your suggestion.

We will check if we can incorporate these changes in the upcoming releases of NMSDK (after thorough evaluation).

Regards,

Sen.

NaServer.rb (ruby API) issue?

Hi Sen,

Thank you for your prompt reply.  I'm looking forward to hearing the update.

Regards,