Coming back to this, I put together a brief script demonstrating the issue:
[Expert@DallasSA]# mgmt_cli -r true login > session.txt
[Expert@DallasSA]# UUID_TO_CHANGE=$(mgmt_cli -f json -s session.txt show hosts limit 1 | jq '.objects[0].uid')
[Expert@DallasSA]# mgmt_cli -f json -s session.txt show host uid "$UUID_TO_CHANGE" details-level full | jq '{readOnly:."read-only",metaInfo:."meta-info"}';mgmt_cli -f json -s session.txt set host uid "$UUID_TO_CHANGE" comments "Testing a change" details-level full | jq '{readOnly:."read-only",metaInfo:."meta-info"}';mgmt_cli -f json -s session.txt show host uid "$UUID_TO_CHANGE" details-level full | jq '{readOnly:."read-only",metaInfo:."meta-info"}'
{
"readOnly": false,
"metaInfo": {
"lock": "unlocked",
"validation-state": "ok",
"last-modify-time": {
"posix": 1637433240653,
"iso-8601": "2021-11-20T18:34+0000"
},
"last-modifier": "WEB_API",
"creation-time": {
"posix": 1637433240653,
"iso-8601": "2021-11-20T18:34+0000"
},
"creator": "WEB_API"
}
}
{
"readOnly": true,
"metaInfo": {
"lock": "unlocked",
"validation-state": "ok",
"last-modify-time": {
"posix": 1666550291300,
"iso-8601": "2022-10-23T18:38+0000"
},
"last-modifier": "WEB_API",
"creation-time": {
"posix": 1637433240653,
"iso-8601": "2021-11-20T18:34+0000"
},
"creator": "WEB_API"
}
}
{
"readOnly": false,
"metaInfo": {
"lock": "locked by current session",
"validation-state": "ok",
"last-modify-time": {
"posix": 1666550291300,
"iso-8601": "2022-10-23T18:38+0000"
},
"last-modifier": "WEB_API",
"creation-time": {
"posix": 1637433240653,
"iso-8601": "2021-11-20T18:34+0000"
},
"creator": "WEB_API"
}
}
Still on API v1.7.1 (R81 jumbo 74).
The main command generates a before-change output, the output from the change call, then an after-change output. The change output updates the read-only property to true, and the meta-info.last-modify-time gets updated, but the meta-info.lock property stays "unlocked". Then immediately after the change, the read-only property goes back to false and the meta-info.lock updates to say it's locked by the current session.
Is this expected behavior? Seems weird to not immediately show the object is locked by the current session. The brief trip through read-only: true is also strange.