This topic describes how to set the password of a node by using obshell-sdk-python.
Note
We recommend that you read through Get started with obshell-sdk-python to learn how to use obshell-sdk-python.
This API is supported starting with obshell V4.2.6.
Considerations
Make sure that obshell is running normally.
Sample code
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance. The node address is '10.10.10.1', the port is 2886, and the password of root@sys is '***'.
client = ClientSet("10.10.10.1", 2886, PasswordAuth(password='***'))
# If the node has been assigned a password, the client initialization should use the node password (agent_password).
# client = ClientSet("10.10.10.1", 2886, PasswordAuth(agent_password='***'))
client.v1.set_agent_password("****")
References
For more information about the API for setting the node password, see Set node password.