From 7e5e4229b794c354d9cc7a5951f00356ea3418c4 Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Mon, 1 Apr 2019 16:02:28 -0400 Subject: [PATCH] ceph-volume: Add PYTHONIOENCODING env variable Since https://github.com/ceph/ceph/commit/77912c0 ceph-volume uses stdout encoding based on LC_CTYPE and PYTHONIOENCODING environment variables. Thoses variables aren't set when using ansible. Currently this commit breaks non containerized deployment on Ubuntu. TASK [use ceph-volume to create bluestore osds] ******************** cmd: - ceph-volume - --cluster - ceph - lvm - create - --bluestore - --data - /dev/sdb rc: 1 stderr: |- Traceback (most recent call last): (...) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 132: ordinal not in range(128) Note that the task is failing on ansible side due to the stdout decoding but the osd creation is successful. Signed-off-by: Dimitri Savineau --- roles/ceph-config/tasks/main.yml | 2 ++ roles/ceph-osd/tasks/scenarios/lvm-batch.yml | 1 + roles/ceph-osd/tasks/scenarios/lvm.yml | 1 + 3 files changed, 4 insertions(+) diff --git a/roles/ceph-config/tasks/main.yml b/roles/ceph-config/tasks/main.yml index 0fa3c833a..2d63cc352 100644 --- a/roles/ceph-config/tasks/main.yml +++ b/roles/ceph-config/tasks/main.yml @@ -37,6 +37,7 @@ CEPH_VOLUME_DEBUG: 1 CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" + PYTHONIOENCODING: utf-8 when: - devices | default([]) | length > 0 - osd_scenario == 'lvm' @@ -57,6 +58,7 @@ CEPH_VOLUME_DEBUG: 1 CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" + PYTHONIOENCODING: utf-8 when: - devices | default([]) | length > 0 - osd_scenario == 'lvm' diff --git a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml index eb0108320..e1f1b304d 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm-batch.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm-batch.yml @@ -15,3 +15,4 @@ CEPH_VOLUME_DEBUG: 1 CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" + PYTHONIOENCODING: utf-8 diff --git a/roles/ceph-osd/tasks/scenarios/lvm.yml b/roles/ceph-osd/tasks/scenarios/lvm.yml index 07f587840..40dbe8f52 100644 --- a/roles/ceph-osd/tasks/scenarios/lvm.yml +++ b/roles/ceph-osd/tasks/scenarios/lvm.yml @@ -18,5 +18,6 @@ CEPH_VOLUME_DEBUG: 1 CEPH_CONTAINER_IMAGE: "{{ ceph_docker_registry + '/' + ceph_docker_image + ':' + ceph_docker_image_tag if containerized_deployment else None }}" CEPH_CONTAINER_BINARY: "{{ container_binary }}" + PYTHONIOENCODING: utf-8 with_items: "{{ lvm_volumes }}" tags: prepare_osd \ No newline at end of file