From 2c57d18c2ef4f4a76d7b50549acd9b4bdb1dcf67 Mon Sep 17 00:00:00 2001 From: BenjiReis Date: Mon, 30 Jan 2023 11:35:28 +0100 Subject: [PATCH] CA-374872: error when `BOND_MEMBERS` is not in `management.conf` It is an optional field, handle its abscence gracefully. Following up: https://github.com/xapi-project/xen-api/pull/4333 (commit: e8dbc1d981ee9cb1f8090da996cd794b0ca1141c) Signed-off-by: BenjiReis --- ocaml/networkd/lib/network_config.ml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ocaml/networkd/lib/network_config.ml b/ocaml/networkd/lib/network_config.ml index e4cd5f2aa30..d9beb1b75c7 100644 --- a/ocaml/networkd/lib/network_config.ml +++ b/ocaml/networkd/lib/network_config.ml @@ -61,7 +61,11 @@ let read_management_conf () = Option.value ~default:"" (List.assoc_opt "BOND_MODE" args) in let bond_members = - String.split_on_char ',' (List.assoc "BOND_MEMBERS" args) + match List.assoc_opt "BOND_MEMBERS" args with + | None -> + [] + | Some x -> + String.split_on_char ',' x in let device = (* Take 1st member of bond *)