From a250d8956969221b8bb53c801f9f20641bbf9bef Mon Sep 17 00:00:00 2001 From: Martin Schuppert Date: Mon, 14 Dec 2020 11:37:13 +0100 Subject: [PATCH] Fix check for existing nvdimm namespaces Due to the use of a folding block operator instead of the literal block operator the check for existing namespaces does not work correct and namespaces get created on subsequent deploy runs even if they already exist. Now namespaces won't get created if the are already there. Change-Id: I7ada7a7b78b7930a68d0204e217e3640c3dd5c73 (cherry picked from commit c437eacb1334636212bcbcab13afca56881e728e) --- .../notes/fix_nvdimm_ns_check-cb0837b5dbf40ab7.yaml | 7 +++++++ .../roles/tripleo_nvdimm/tasks/create_namespaces.yml | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/fix_nvdimm_ns_check-cb0837b5dbf40ab7.yaml diff --git a/releasenotes/notes/fix_nvdimm_ns_check-cb0837b5dbf40ab7.yaml b/releasenotes/notes/fix_nvdimm_ns_check-cb0837b5dbf40ab7.yaml new file mode 100644 index 000000000..ac813022c --- /dev/null +++ b/releasenotes/notes/fix_nvdimm_ns_check-cb0837b5dbf40ab7.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Due to the use of a folding block operator instead of the literal block + operator the check for existing namespaces does not work correct and + namespaces get created on subsequent deploy runs even if they already + exist. Now namespaces won't get created if the are already there. diff --git a/tripleo_ansible/roles/tripleo_nvdimm/tasks/create_namespaces.yml b/tripleo_ansible/roles/tripleo_nvdimm/tasks/create_namespaces.yml index 795fcb01b..3edbdbdf9 100644 --- a/tripleo_ansible/roles/tripleo_nvdimm/tasks/create_namespaces.yml +++ b/tripleo_ansible/roles/tripleo_nvdimm/tasks/create_namespaces.yml @@ -15,15 +15,15 @@ # under the License. - name: list current namespaces - shell: >- - ndctl list -X | jq ".[].name" + shell: | + ndctl list -X | jq -r ".[].name" register: namespaces changed_when: false - name: create namespace command: >- ndctl create-namespace -s {{ input[0] }} -m devdax -M mem -n {{ input[1] }} when: - - namespaces.stdout is defined - - input[1] not in namespaces.stdout + - namespaces.stdout_lines is defined + - input[1] not in namespaces.stdout_lines register: ret changed_when: ret.rc == 0