From d4d15d0407cd856c39776d42dddad6dd65051ebb Mon Sep 17 00:00:00 2001 From: James Slagle Date: Mon, 6 Aug 2018 12:23:28 -0400 Subject: [PATCH] Default bootstrap_server_id When blacklisting all servers from the primary role, the yaql expression to get the bootstrap_server_id value fails as it tries to index the list at the 0'th element. In this case, default the bootstrap_server_id value to a constant string which won't match any actual server id's. Change-Id: Ibb26245156675f64709bab075875ce4b498b4db6 Closes-Bug: #1785665 --- common/deploy-steps.j2 | 6 +++++- .../notes/default-bootstrap-server-id-eff49ef40bfde414.yaml | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/default-bootstrap-server-id-eff49ef40bfde414.yaml diff --git a/common/deploy-steps.j2 b/common/deploy-steps.j2 index 9674373d4f..003717ce75 100644 --- a/common/deploy-steps.j2 +++ b/common/deploy-steps.j2 @@ -269,7 +269,11 @@ resources: properties: value: yaql: - expression: $.data.items().orderBy($[0]).first()[1] + # Use a constant string of "bootstrap_server_id" when there are no + # servers in the primary role, such as in the case when all + # Controllers are blacklisted. No server id's will match the string + # which is what we want when all are blacklisted. + expression: switch($.data = {} => "no_bootstrap_server", $.data != {} => $.data.items().orderBy($[0]).first()[1]) data: {get_param: [servers, {{primary_role_name}}]} # Artifacts config and HostPrepConfig is done on all roles, not only diff --git a/releasenotes/notes/default-bootstrap-server-id-eff49ef40bfde414.yaml b/releasenotes/notes/default-bootstrap-server-id-eff49ef40bfde414.yaml new file mode 100644 index 0000000000..56a5f95cab --- /dev/null +++ b/releasenotes/notes/default-bootstrap-server-id-eff49ef40bfde414.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - Previously, when blacklisting all servers of the primary role, the stack + would fail since the bootstrap server id was empty. The value is now + defaulted in case all primary role servers are blacklisted.