[openstack-nova/f20] use more efficient systemd interaction
Pádraig Brady
pbrady at fedoraproject.org
Fri Oct 10 17:31:32 UTC 2014
commit 6ca66c030a55f9918fa5aa7f51b17b6103972b49
Author: Pádraig Brady <P at draigBrady.com>
Date: Fri Oct 10 18:25:26 2014 +0100
use more efficient systemd interaction
We can now pass multiple services to each systemd macro.
Also use %{name} more in the spec file.
openstack-nova.spec | 92 ++++++++++++++++++++++++---------------------------
1 files changed, 43 insertions(+), 49 deletions(-)
---
diff --git a/openstack-nova.spec b/openstack-nova.spec
index cf0bed9..55837c6 100644
--- a/openstack-nova.spec
+++ b/openstack-nova.spec
@@ -712,35 +712,35 @@ exit 0
%post compute
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-compute
+/sbin/chkconfig --add %{name}-compute
%else
%systemd_post %{name}-compute.service
%endif
%post network
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-network
+/sbin/chkconfig --add %{name}-network
%else
%systemd_post %{name}-network.service
%endif
%post conductor
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-conductor
+/sbin/chkconfig --add %{name}-conductor
%else
%systemd_post %{name}-conductor.service
%endif
%post scheduler
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-scheduler
+/sbin/chkconfig --add %{name}-scheduler
%else
%systemd_post %{name}-scheduler.service
%endif
%post cert
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-cert
+/sbin/chkconfig --add %{name}-cert
%else
%systemd_post %{name}-cert.service
%endif
@@ -748,7 +748,7 @@ exit 0
%post api
%if 0%{?rhel} && 0%{?rhel} <= 6
for svc in api metadata-api; do
- /sbin/chkconfig --add openstack-nova-$svc
+ /sbin/chkconfig --add %{name}-$svc
done
%else
%systemd_post %{name}-api.service %{name}-metadata-api.service
@@ -756,7 +756,7 @@ done
%post objectstore
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-objectstore
+/sbin/chkconfig --add %{name}-objectstore
%else
%systemd_post %{name}-objectstore.service
%endif
@@ -764,7 +764,7 @@ done
%post console
%if 0%{?rhel} && 0%{?rhel} <= 6
for svc in console consoleauth xvpvncproxy; do
- /sbin/chkconfig --add openstack-nova-$svc
+ /sbin/chkconfig --add %{name}-$svc
done
%else
%systemd_post %{name}-console.service %{name}-consoleauth.service %{name}-xvpvncproxy.service
@@ -772,7 +772,7 @@ done
%post cells
%if 0%{?rhel} && 0%{?rhel} <= 6
-/sbin/chkconfig --add openstack-nova-cells
+/sbin/chkconfig --add %{name}-cells
%else
%systemd_post %{name}-cells.service
%endif
@@ -782,8 +782,8 @@ done
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in compute; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -794,8 +794,8 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in network; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -806,8 +806,8 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in scheduler; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -818,8 +818,8 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in cert; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -830,21 +830,20 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in api metadata-api; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
-%systemd_preun %{name}-api.service
-%systemd_preun %{name}-metadata-api.service
+%systemd_preun %{name}-api.service %{name}-metadata-api.service
%endif
%preun objectstore
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in objectstore; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -855,8 +854,8 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in conductor; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -867,22 +866,20 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in console consoleauth xvpvncproxy; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
-%systemd_preun %{name}-console.service
-%systemd_preun %{name}-consoleauth.service
-%systemd_preun %{name}-xvpvncproxy.service
+%systemd_preun %{name}-console.service %{name}-consoleauth.service %{name}-xvpvncproxy.service
%endif
%preun cells
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in cells; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -893,8 +890,8 @@ fi
%if 0%{?rhel} && 0%{?rhel} <= 6
if [ $1 -eq 0 ] ; then
for svc in novncproxy; do
- /sbin/service openstack-nova-${svc} stop >/dev/null 2>&1
- /sbin/chkconfig --del openstack-nova-${svc}
+ /sbin/service %{name}-${svc} stop >/dev/null 2>&1
+ /sbin/chkconfig --del %{name}-${svc}
done
fi
%else
@@ -908,7 +905,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in compute; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -921,7 +918,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in network; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -934,7 +931,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in scheduler; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -947,7 +944,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in cert; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -960,12 +957,11 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in api metadata-api; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
-%systemd_postun_with_restart %{name}-api.service
-%systemd_postun_with_restart %{name}-metadata-api.service
+%systemd_postun_with_restart %{name}-api.service %{name}-metadata-api.service
%endif
%postun objectstore
@@ -974,7 +970,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in objectstore; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -987,7 +983,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in conductor; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -1000,13 +996,11 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in console consoleauth xvpvncproxy; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
-%systemd_postun_with_restart %{name}-console.service
-%systemd_postun_with_restart %{name}-consoleauth.service
-%systemd_postun_with_restart %{name}-xvpvncproxy.service
+%systemd_postun_with_restart %{name}-console.service %{name}-consoleauth.service %{name}-xvpvncproxy.service
%endif
%postun cells
@@ -1015,7 +1009,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in cells; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
@@ -1028,7 +1022,7 @@ fi
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
for svc in novncproxy; do
- /sbin/service openstack-nova-${svc} condrestart > /dev/null 2>&1 || :
+ /sbin/service %{name}-${svc} condrestart > /dev/null 2>&1 || :
done
fi
%else
More information about the scm-commits
mailing list