This topic describes how to change the root user password of a tenant by using obshell-sdk-python.
Note
We recommend that you first read Get started with obshell-sdk-python to learn how to use obshell-sdk-python.
Considerations
Make sure that obshell is running.
Make sure that the tenant exists and is in the NORMAL state.
The node corresponding to the client must be in an initialized cluster.
You cannot change the root user password of the system tenant.
Sample code
The following sample code shows how to change the password of a tenant synchronously:
from obshell import ClientSet
from obshell.auth import PasswordAuth
# Create a client instance with the node address '10.10.10.1' and port 2886.
client = ClientSet("10.10.10.1", 2886, PassswordAuth("****"))
client.v1.set_tenant_root_password("t1", new_password="****", old_password="****")
References
For more information about the API for changing a tenant password, see Change a tenant password.
For more information about how to call the API method by using obshell-sdk-go, see Change a tenant password.