[openstack-glance/el6-icehouse] programmatically sync dist.conf with editable defaults in /etc/glance

Pádraig Brady pbrady at fedoraproject.org
Thu Apr 24 10:46:43 UTC 2014


commit cb30804af9b098696f829d1a29f13d29c4a2bb90
Author: Pádraig Brady <P at draigBrady.com>
Date:   Thu Apr 24 11:39:22 2014 +0100

    programmatically sync dist.conf with editable defaults in /etc/glance
    
    Possible now that glance config and logic defaults are mostly in sync.
    This ensures that default config items like [paste_deploy]/config_file
    and [database]/connection are accurate.

 openstack-glance.spec |   28 ++++++++++++++++++++++++----
 1 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/openstack-glance.spec b/openstack-glance.spec
index b121634..1cf545f 100644
--- a/openstack-glance.spec
+++ b/openstack-glance.spec
@@ -2,7 +2,7 @@
 
 Name:             openstack-glance
 Version:          2014.1
-Release:          1%{?dist}
+Release:          2%{?dist}
 Summary:          OpenStack Image Service
 
 Group:            Applications/System
@@ -145,9 +145,26 @@ sed -i 's/oslosphinx/oslo.sphinx/' doc/source/conf.py
 # to distutils requiers_dist config
 rm -rf {test-,}requirements.txt tools/{pip,test}-requires
 
-# Adjust DB config to be compat with openstack-db
-for svc in api registry; do
-  sed -i 's|^#connection = <None>|#connection = mysql://glance:glance@localhost/glance|' etc/glance-$svc.conf
+# Programmatically update defaults in example config
+api_dist=%{SOURCE5}
+registry_dist=%{SOURCE6}
+cache_dist=%{SOURCE7}
+scrubber_dist=%{SOURCE8}
+for svc in api registry cache scrubber; do
+  #  First we ensure all values are commented in appropriate format.
+  #  Since icehouse, there was an uncommented keystone_authtoken section
+  #  at the end of the file which mimics but also conflicted with our
+  #  distro editing that had been done for many releases.
+  sed -i '/^[^#[]/{s/^/#/; s/ //g}; /^#[^ ]/s/ = /=/' etc/glance-$svc.conf
+
+  #  TODO: Make this more robust
+  #  Note it only edits the first occurance, so assumes a section ordering in sample
+  #  and also doesn't support multi-valued variables like dhcpbridge_flagfile.
+  eval dist_conf=\$${svc}_dist
+  while read name eq value; do
+    test "$name" && test "$value" || continue
+    sed -i "0,/^# *$name=/{s!^# *$name=.*!#$name=$value!}" etc/glance-$svc.conf
+  done < $dist_conf
 done
 
 %build
@@ -316,6 +333,9 @@ fi
 %doc doc/build/html
 
 %changelog
+* Thu Apr 24 2014 Pádraig Brady <pbrady at redhat.com> - 2014.1-2
+- Comment all default config items in /etc/glance/*.conf
+
 * Thu Apr 17 2014 Pádraig Brady <pbrady at redhat.com> - 2014.1-1
 - Update to Icehouse release
 


More information about the scm-commits mailing list