SettingValue(credentialID) is not getting updated
Closed this issue · 1 comments
goutham-kumar commented
I am trying to add a node using rest api, soon after adding the node trying to change the credentialID using the below code
prop = {
"NodeID": nodeid,
"SettingName": "ROSNMPCredentialID",
"SettingValue": credentialID
}
result = swis.create("Orion.NodeSettings", **prop)
but i see 2 credentialID's for single nodeID in "Orion.NodeSettings" .
Please let me know if there is any solution to get rid of earlier credentialID
goutham-kumar commented
Querying the URI from nodeSettings and passing the properties dict as parameter resolved this issue for me. Thanks for THWACK.
results = self.swis.query("SELECT Uri FROM Orion.NodeSettings where NodeID=@id", id=nodeid)
uri = results["results"][0]["Uri"]
properties = {
"SettingName": "ROSNMPCredentialID",
"SettingValue": NEW_CREDENTIAL_ID
}
results = self.swis.update(uri, **properties)