[openstack-glance/f21] Merge spec from el6-icehouse

Haïkel Guémar hguemar at fedoraproject.org
Wed Sep 3 12:21:35 UTC 2014


commit 55f5d0789dee2c59dec233550bbf75f3ab912cca
Author: Haïkel Guémar <hguemar at fedoraproject.org>
Date:   Wed Sep 3 14:08:10 2014 +0200

    Merge spec from el6-icehouse

 openstack-glance.spec |   99 ++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 86 insertions(+), 13 deletions(-)
---
diff --git a/openstack-glance.spec b/openstack-glance.spec
index cb1d411..9f33a46 100644
--- a/openstack-glance.spec
+++ b/openstack-glance.spec
@@ -1,6 +1,6 @@
 Name:             openstack-glance
 Version:          2014.1.2
-Release:          1%{?dist}
+Release:          2%{?dist}
 Summary:          OpenStack Image Service
 
 Group:            Applications/System
@@ -17,6 +17,13 @@ Source6:          glance-registry-dist.conf
 Source7:          glance-cache-dist.conf
 Source8:          glance-scrubber-dist.conf
 
+Source9:          openstack-glance-api.init
+Source900:        openstack-glance-api.upstart
+Source10:         openstack-glance-registry.init
+Source1000:       openstack-glance-registry.upstart
+Source11:         openstack-glance-scrubber.init
+Source1100:       openstack-glance-scrubber.upstart
+
 #
 # patches_base=2014.1.2
 #
@@ -41,6 +48,21 @@ Requires:         openstack-utils
 BuildRequires:    python-pbr
 BuildRequires:    python-oslo-sphinx
 
+%if 0%{?rhel} == 6
+Requires(post):   chkconfig
+Requires(postun): initscripts
+Requires(preun):  chkconfig
+Requires(preun):  initscripts
+# for daemon_notify
+Requires: /usr/bin/uuidgen
+Requires: /bin/sleep
+%else
+Requires(post): systemd
+Requires(preun): systemd
+Requires(postun): systemd
+BuildRequires: systemd
+%endif
+
 %description
 OpenStack Image Service (code-named Glance) provides discovery, registration,
 and delivery services for virtual disk images. The Image Service API server
@@ -207,10 +229,24 @@ install -p -D -m 644 %{SOURCE8} %{buildroot}%{_datadir}/glance/glance-scrubber-d
 install -p -D -m 640 etc/policy.json %{buildroot}%{_sysconfdir}/glance/policy.json
 install -p -D -m 640 etc/schema-image.json %{buildroot}%{_sysconfdir}/glance/schema-image.json
 
+%if 0%{?rhel} == 6
+# Install service readiness wrapper
+install -p -D -m 755 %{SOURCE22} %{buildroot}%{_initrddir}/openstack-glance-api
+install -p -D -m 644 %{SOURCE23} %{buildroot}%{_datadir}/glance/openstack-glance-api.upstart
+
+install -p -D -m 755 %{SOURCE22} %{buildroot}%{_initrddir}/openstack-glance-registry
+install -p -D -m 644 %{SOURCE23} %{buildroot}%{_datadir}/glance/openstack-glance-registry.upstart
+
+install -p -D -m 755 %{SOURCE22} %{buildroot}%{_initrddir}/openstack-glance-scrubber
+install -p -D -m 644 %{SOURCE23} %{buildroot}%{_datadir}/glance/openstack-glance-scrubber.upstart
+%else
 # Initscripts
 install -p -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/openstack-glance-api.service
 install -p -D -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/openstack-glance-registry.service
 install -p -D -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/openstack-glance-scrubber.service
+%endif
+
+
 
 # Logrotate config
 install -p -D -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-glance
@@ -221,6 +257,10 @@ install -d -m 755 %{buildroot}%{_localstatedir}/run/glance
 # Install log directory
 install -d -m 755 %{buildroot}%{_localstatedir}/log/glance
 
+%if 0%{?rhel} == 6
+install -d -m 755 %{buildroot}%{_localstatedir}/run/glance
+%endif
+
 # Programmatically update defaults in sample config
 # which is installed at /etc/$project/$program.conf
 # TODO: Make this more robust
@@ -246,31 +286,51 @@ useradd -u 161 -r -g glance -d %{_sharedstatedir}/glance -s /sbin/nologin \
 exit 0
 
 %post
+%if 0%{?rhel} == 6
 if [ $1 -eq 1 ] ; then
     # Initial installation
-    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+    /sbin/chkconfig --add openstack-glance-api
+    /sbin/chkconfig --add openstack-glance-registry
+    /sbin/chkconfig --add openstack-glance-scrubber
 fi
+%else
+# Initial installation
+%systemd_post openstack-glance-api.service
+%systemd_post openstack-glance-registry.service
+%systemd_post openstack-glance-scrubber.service
+%endif
 
 
 %preun
+%if 0%{?rhel} == 6
 if [ $1 -eq 0 ] ; then
-    # Package removal, not upgrade
-    /bin/systemctl --no-reload disable openstack-glance-api.service > /dev/null 2>&1 || :
-    /bin/systemctl --no-reload disable openstack-glance-registry.service > /dev/null 2>&1 || :
-    /bin/systemctl --no-reload disable openstack-glance-scrubber.service > /dev/null 2>&1 || :
-    /bin/systemctl stop openstack-glance-api.service > /dev/null 2>&1 || :
-    /bin/systemctl stop openstack-glance-registry.service > /dev/null 2>&1 || :
-    /bin/systemctl stop openstack-glance-scrubber.service > /dev/null 2>&1 || :
+    /sbin/service openstack-glance-api stop >/dev/null 2>&1
+    /sbin/service openstack-glance-registry stop >/dev/null 2>&1
+    /sbin/service openstack-glance-scrubber stop >/dev/null 2>&1
+
+    /sbin/chkconfig --del openstack-glance-api
+    /sbin/chkconfig --del openstack-glance-registry
+    /sbin/chkconfig --del openstack-glance-scrubber
 fi
+%else
+%systemd_preun openstack-glance-api.service
+%systemd_preun openstack-glance-registry.service
+%systemd_preun openstack-glance-scrubber.service
+%endif
 
 %postun
-/bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%if 0%{?rhel} == 6
 if [ $1 -ge 1 ] ; then
     # Package upgrade, not uninstall
-    /bin/systemctl try-restart openstack-glance-api.service >/dev/null 2>&1 || :
-    /bin/systemctl try-restart openstack-glance-registry.service >/dev/null 2>&1 || :
-    /bin/systemctl try-restart openstack-glance-scrubber.service >/dev/null 2>&1 || :
+    /sbin/service openstack-glance-api condrestart >/dev/null 2>&1 || :
+    /sbin/service openstack-glance-registry condrestart >/dev/null 2>&1 || :
+    /sbin/service openstack-glance-scrubber condrestart >/dev/null 2>&1 || :
 fi
+%else
+%systemd_postun_with_restart openstack-glance-api.service
+%systemd_postun_with_restart openstack-glance-registry.service
+%systemd_postun_with_restart openstack-glance-scrubber.service
+%endif
 
 %files
 %doc README.rst
@@ -292,9 +352,19 @@ fi
 %{_datadir}/glance/glance-api-dist-paste.ini
 %{_datadir}/glance/glance-registry-dist-paste.ini
 
+%if 0%{?rhel} == 6
+%{_datadir}/glance/openstack-glance-api.upstart
+%{_datadir}/glance/openstack-glance-registry.upstart
+%{_datadir}/glance/openstack-glance-scrubber.upstart
+%{_initrddir}/openstack-glance-api
+%{_initrddir}/openstack-glance-registry
+%{_initrddir}/openstack-glance-scrubber
+%else
 %{_unitdir}/openstack-glance-api.service
 %{_unitdir}/openstack-glance-registry.service
 %{_unitdir}/openstack-glance-scrubber.service
+%endif
+
 %{_mandir}/man1/glance*.1.gz
 %dir %{_sysconfdir}/glance
 %config(noreplace) %attr(-, root, glance) %{_sysconfdir}/glance/glance-api.conf
@@ -318,6 +388,9 @@ fi
 %doc doc/build/html
 
 %changelog
+* Wed Sep  3 2014 Haïkel Guémar <hguemar at fedoraproject.org> - 2014.1.2-2
+- Merge spec from el6-icehouse
+
 * Tue Sep 02 2014 Flavio Percoco <flavio at redhat.com> - 2014.1.2-1
 - Update to latest Icehouse release
 - Glance store disk space exhaustion CVE-2014-5356


More information about the scm-commits mailing list