Skip to content
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

Merged
merged 3 commits into from
Jul 15, 2024

Conversation

psafont
Copy link
Member

@psafont psafont commented Jul 12, 2024

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.

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
Copy link
Member

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 :?

Copy link
Member

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, []))
Copy link
Contributor

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.

@psafont psafont merged commit dcf558f into xapi-project:master Jul 15, 2024
15 checks passed
@psafont psafont deleted the private/paus/scrub branch July 15, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants