bhouse-nexthop commented on PR #14641:
URL: https://github.com/apache/cloudstack/pull/14641#issuecomment-6988396847

   @weizhouapache I've tested it together with #14309. This PR returns the 
scoped value for a Secure setting too, and the two PRs don't get in each 
other's way.
   
   ### Test report: #14641 with #14309, on a domain-scoped Secure setting
   
   **Environment**
   - A CloudStack 24.0 (main) build with this PR and #14309, alongside some of 
my other open PRs. One management server and three KVM hosts.
   - #14309 targets 4.20. Its production change applied to main unchanged; only 
the imports in `ApiResponseHelperTest` conflicted, so I left its unit test out 
of this build.
   - Setting: `ldap.bind.password` (category `Secure`, scope Domain), in a new 
test domain. To read the encrypted values, I decrypted them with the management 
server's key.
   
   **Steps and results**
   
   | Step | Result |
   |---|---|
   | `updateConfiguration name=ldap.bind.password value=cfgtest-global-secret` 
(global) | the global value is set |
   | `updateConfiguration name=ldap.bind.password value=cfgtest-domain-secret 
domainid=<domain>` | `"scope":"domain"`; the value is encrypted and decrypts to 
`cfgtest-domain-secret`, not the global value |
   | `listConfigurations name=ldap.bind.password` (global), twice | the same 
encrypted value both times, unchanged by the scoped update; it decrypts to 
`cfgtest-global-secret` |
   | `listConfigurations name=ldap.bind.password domainid=<domain>`, twice | 
both decrypt to `cfgtest-domain-secret` |
   | `updateConfiguration name=drs.algorithm value=condensed 
clusterid=<cluster>` (not Secure) | `{"scope":"cluster","value":"condensed"}`; 
the global value is still `balanced` |
   | `resetConfiguration` for the domain, the cluster and the global value | no 
scoped rows are left, and the global value is back to unset |
   
   **Result:** pass. The two PRs touch different paths:
   - this PR changes the object that `updateConfiguration` returns;
   - #14309 changes `ApiResponseHelper.createConfigurationResponse()`;
   - for `updateConfiguration`, `UpdateCfgCmd.setResponseValue()` then sets the 
value again, as `encrypt(cfg.getValue())`. So with both PRs, a scoped update 
answers with the scoped value, encrypted.
   
   **Seen along the way, for #14309 (cc @Damans227)**
   
   With #14309, a **scoped** `listConfigurations` of a Secure setting still 
gives a different encrypted value on each call. In the two calls above, the 
values began `geN5x801…` and `nC/9E0e6…`, and both decrypt to the same value. 
`ManagementServerImpl.searchForConfigurations()` copies the row and calls 
`configVo.setValue(<scoped value>)` on the copy. For a Secure setting, 
`setValue()` encrypts again, so `getRawValue()` returns a fresh encryption each 
time. #14309 makes the global listing stable but not the scoped listing. This 
doesn't come from this PR: the scoped list path is the same with or without it.
   
   **Not covered**
   - Zone, account, cluster and storage pool scopes for a Secure setting. They 
go through the same code.
   - 4.20 and 4.22. This PR is for main only.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to