Subscribe

Inconsistent Behavior Using HOSTS Authentication in API

I am attempting to use the Ruby API library. I don't like the idea of storing passwords in scripts, so I want to use HOSTS authentication (only marginally better, but that's the choice I get). I created a terribly simple script:

require 'NaServer'

filer = NaServer::new('hen01', 1, 15)

filer.set_admin_user('root', '')

filer.set_style "HOSTS"

output = filer.invoke("system-get-version")

if(output.results_errno != 0)

  puts "Error: " + output.results_reason

else

  puts "DOT version is: " + output.child_get_string("version") + "\n"

end

I can run this script over and over and about 20% of the time I get the server version back and about 80% of the time I get:

User  does not have capability to invoke API system-get-version.

(Notice there is an extra space after "User", implying an empty string in the output, implying the username isn't being procured correctly.)

Anyone have similar experience(s) and/or suggestions on how to make this consistently work?

Re: Inconsistent Behavior Using HOSTS Authentication in API

Hi Brian,

Can you try removing 'filer.set_admin_user' statement?

In case of "HOSTS" style, username and password need not be set.

Also, ensure that you are root user while executing the script on the client.

Re: Inconsistent Behavior Using HOSTS Authentication in API

Same behavior with and without the set_admin_user call, and yes, I am running the script as root.