#Hardcoding "host" for Cluster.

1 messages · Page 1 of 1 (latest)

small timber
#

Hi, i have a query on netapp ontap API interface.
There is an import Cluster from netapp_ontap.resources.
A variable endpoint has created an instance of Cluster as, endpoint=Cluster().
This led to usage of a function set_config_connection(), in which a variable host is set as, host=find_nodes()[0].

I believe that the function set_config_connection() was invoked by creating intsance, as it was seen in LOG.

Now, I want to hardcode the host value. Can I just give it while creating instance like, endpoint=Cluster(host="<host>").

Further this endpoint is used for GET operation, where I found it is using Node IP, wanted to make it work with cluster management IP

Please help out!
It would be helpful if there s a detailed documentation of Cluster's arguments for parameterizing.

fair shuttle
#

Not familiar with the particular Cluster object and its use, but am working on the possibly related subject on setting global connections and the related problems. Not sure though this is your issue, was not able to find any reference to the method you are mentioning, the set_config_connection()... Is this your private method or something from netapp client library?

small timber
#

It is silmilar to Cluster.set_connection(), and just realized it is from a private library. Someone who's from netapp may know about it. Anyways, it would be more helpful if they have mentioned what params can be set through args in documentation for Cluster() with examples.

fair shuttle
#

Hmm I am 'from NetApp' but did not hear of that method... Also, not sure if host can be set at Cluster instantiation, and to expect the connection will be created subsequently, I mean, what about the username and password or other auth method... In my code I found out the (already established) connection can be assigned when you want to .find() something, for example: vol = netapp_ontap.resources.Volume.find(name=volname, connection=restconn) but not when you instantiate something like: svm = netapp_ontap.resources.Svm() where you have to explicitly associate connection with the newly created object, for example: this_svm.set_connection(restconn)

small timber
#

Appreciate that info, really helps. Will there be any constructors which implicitly invoke this method I was saying on creating instance of Cluster. haven't found any reference in documentation regarding this.

fair shuttle
#

I am not sure about constructors having the connection set within, mainly because the constructor itself does not do anything at the time of constructing, as in , it does not initiate any over-the-wire request (get,patch,post) so it does not have the means to validate the connection as such. On the other hand .find() is actually doing the get internally and it is exercising and validating the connection. and is returning the instance of the found existing resurce, including its valid connection. Maybe you can try to .find() your cluster, assuming you are trying to get the instance of existing cluster, not creating the new one... But that is my best semi-educated guess, I am also end-user when it comes to the python ontap rest library...