1 From 5d8f3dd5d18d611151b4658c5c876e8a3ad8fe51 Mon Sep 17 00:00:00 2001
2 From: Daniel Badea <daniel.badea@windriver.com>
3 Date: Wed, 31 Oct 2018 16:28:45 +0000
4 Subject: [PATCH] ceph-disk prepare invalid data disk value
6 ceph-disk prepare data OSD parameter contains a new line causing
7 puppet manifest to fail:
9 1. $data = generate('/bin/bash','-c',"/bin/readlink -f ${name}")
11 is expanded together with a new line in:
14 command => "/usr/sbin/ceph-disk prepare ${cluster_option}
15 ${cluster_uuid_option} ${uuid_option}
16 --fs-type xfs --zap-disk ${data} ${journal}"
18 just before ${journal} is expanded. Puppet reports:
20 sh: line 1: : command not found
22 when trying to run '' (default journal value).
24 2. 'readlink' should be called when running ceph-disk prepare
25 command, not when the puppet resource is defined. Let
26 exec's shell call readlink instead of using puppet's
27 generate() . See also:
29 https://github.com/openstack/puppet-ceph/commit/ff2b2e689846dd3d980c7c706c591e8cfb8f33a9
31 Added --verbose and --log-stdout options to log commands executed
32 by 'ceph-disk prepare' and identify where it fails.
34 manifests/osd.pp | 6 +++---
35 1 file changed, 3 insertions(+), 3 deletions(-)
37 diff --git a/manifests/osd.pp b/manifests/osd.pp
38 index d9cf5b1..889d28a 100644
39 --- a/manifests/osd.pp
40 +++ b/manifests/osd.pp
41 @@ -61,7 +61,7 @@ define ceph::osd (
43 include ::ceph::params
45 - $data = generate('/bin/bash','-c',"/bin/readlink -f ${name}")
49 $cluster_name = $cluster
50 @@ -131,13 +131,13 @@ test -z $(ceph-disk list $(readlink -f ${data}) | egrep -o '[0-9a-f]{8}-([0-9a-f
51 # ceph-disk: prepare should be idempotent http://tracker.ceph.com/issues/7475
54 - command => "/usr/sbin/ceph-disk prepare ${cluster_option} ${cluster_uuid_option} ${uuid_option} --fs-type xfs --zap-disk ${data} ${journal}",
55 + command => "/usr/sbin/ceph-disk --verbose --log-stdout prepare ${cluster_option} ${cluster_uuid_option} ${uuid_option} --fs-type xfs --zap-disk $(readlink -f ${data}) $(readlink -f ${journal})",
56 # We don't want to erase the disk if:
57 # 1. There is already ceph data on the disk for our cluster AND
58 # 2. The uuid for the OSD we are configuring matches the uuid for the
59 # OSD on the disk. We don't want to attempt to re-use an OSD that
60 # had previously been deleted.
61 - unless => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep ' *${data}.*ceph data' | grep 'osd uuid ${uuid}'",
62 + unless => "/usr/sbin/ceph-disk list | grep -v 'unknown cluster' | grep \" *$(readlink -f ${data}).*ceph data\" | grep 'osd uuid ${uuid}'",
65 timeout => $exec_timeout,