From e188ce71ca7361adfee668f8d17d0d78f360dc90 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 3 Jun 2024 12:28:38 -0700 Subject: [PATCH] Validate that node_version is set We removed the default value, because having a default value actually makes no sense at all. To be helpful for any transitions, add a runtime check that the variable is set. Also, while we're at it, update the docs to indicate that the parameter is required. Change-Id: I1e18ea51d9d56561608ff241d71b63965c4f78bd --- roles/ensure-nodejs/README.rst | 3 ++- roles/ensure-nodejs/tasks/main.yaml | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/roles/ensure-nodejs/README.rst b/roles/ensure-nodejs/README.rst index 09f7e0679..eda190572 100644 --- a/roles/ensure-nodejs/README.rst +++ b/roles/ensure-nodejs/README.rst @@ -3,4 +3,5 @@ Install NodeJS from nodesource **Role Variables** .. zuul:rolevar:: node_version - :default: 6 + + Required. What version of Node to install. diff --git a/roles/ensure-nodejs/tasks/main.yaml b/roles/ensure-nodejs/tasks/main.yaml index c97152fc0..0437edc76 100644 --- a/roles/ensure-nodejs/tasks/main.yaml +++ b/roles/ensure-nodejs/tasks/main.yaml @@ -1,3 +1,7 @@ +- name: Ensure we know what version of node to install + assert: + that: node_version is defined + - name: Update apt cache apt: update_cache: yes