-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xapi-cli-server: add functions to print maps #5823
Conversation
Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
It forced users to define how the elements were concatenated, allowing usage to be inconsistent. Fortunately this was not the case, but it's better to define the concatenation in a single place and reduce possible mistakes. Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
It forced users to define how the elements were concatenated, allowing usage to be inconsistent. Fortunately this was not the case, but it's better to define the concatenation in a single place and reduce possible mistakes. Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
@@ -182,6 +182,10 @@ let map_and_concat_compat f rs = concat_with_comma (List.map f rs) | |||
|
|||
let get_uuids_from_refs rs = map_and_concat get_uuid_from_ref rs | |||
|
|||
let get_from_map rs = | |||
let make_kv (a, b) = Printf.sprintf "%s: %s" a b in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean ;
rather than :
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no, I see now that map_and_concat
does the concat with semicolons.
raise (Api_errors.Server_error (List.hd params, List.tl params)) | ||
match Client.Task.get_error_info ~rpc ~session_id ~self:task_id with | ||
| [] -> | ||
raise Api_errors.(Server_error (internal_error, [])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's worth defining a function internal_error
for this related pattern. @last-genius recently defined one, maybe it's accessible from here or could be added.
Previously, users were forced to define how the elements were concatenated, allowing usage to
be inconsistent.
Fortunately this was not the case, but it's better to define the concatenation
in a single place and reduce possible mistakes.