From: Thomas Goirand <thomas@goirand.fr>
Date: Thu, 1 Oct 2015 16:10:15 +0000 (+0000)
Subject: Fixes default cinder.conf as the generator is broken.
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=77e528387f1db04d03185e60f7f7668eb4d039b1;p=openstack-build%2Fcinder-build.git

Fixes default cinder.conf as the generator is broken.
---

diff --git a/debian/changelog b/debian/changelog
index a3788b57c..261a314a8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-cinder (2:7.0.0~rc1-2) UNRELEASED; urgency=medium
+cinder (2:7.0.0~rc1-2) experimental; urgency=medium
 
   * cinder-api depends on python-openstackclient.
   * Fixed cinder.conf generation.
diff --git a/debian/gen-fixed-config b/debian/gen-fixed-config
new file mode 100755
index 000000000..88ed7089c
--- /dev/null
+++ b/debian/gen-fixed-config
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+set -x
+
+#tools/config/generate_sample.sh
+
+SOURCE=etc/cinder/cinder.conf.sample
+DESTIN=debian/cinder-common/usr/share/cinder-common/cinder.conf
+
+TMP_FILE=`mktemp -t build-cinder-XXXXXX`
+TMP_FILE2=`mktemp -t build-cinder-XXXXXX`
+NUM_LINES=`cat ${SOURCE} | wc -l`
+NUM_LINES_MINUS_ONE=$(( ${NUM_LINES} - 1 ))
+tail -n ${NUM_LINES_MINUS_ONE} ${SOURCE} > ${TMP_FILE}
+echo "[DEFAULT]" >${DESTIN}
+
+echo "enabled_backends = lvm" >>${DESTIN}
+
+cat ${TMP_FILE} >>${DESTIN}
+echo "[lvm]
+volume_driver = cinder.volume.drivers.lvm.LVMVolumeDriver
+volume_group = pkgosvg0
+iscsi_protocol = iscsi
+iscsi_helper = tgtadm  
+" >>${DESTIN}
diff --git a/debian/rules b/debian/rules
index 433596cff..5126faffd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -53,7 +53,11 @@ override_dh_install:
 #		--namespace oslo.utils \
 #		--namespace oslo.versionedobjects \
 #		--namespace oslo.vmware
-	cp etc/cinder/cinder.conf.sample $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
+	# The generator is currently missing enabled_backend and the [lvm]
+	# section. This script fixes it until upstream gets smarter.
+	chmod +x debian/gen-fixed-config
+	./debian/gen-fixed-config
+	#cp etc/cinder/cinder.conf.sample $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf
 
 	# Disable https in default setup, as this makes our CI fail
 	sed -i 's/^[ \t#]*auth_protocol[ \t]*=[ \t].*/auth_protocol = http/' $(CURDIR)/debian/cinder-common/usr/share/cinder-common/cinder.conf