From 5415c06f3027fe585fcf97259f2ea1e99d29df7a Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 19 May 2016 11:14:01 +0530 Subject: [PATCH] packaging: backup commands.properties when upgrade to dynamic-roles In case of rpms, the commands.properties file is bundled at /usr/share/cloudstack-management/webapps/client/WEB-INF/classes/commands.properties In case of a rpm upgrade, new rpms won't ship with commands.properties file. For existing installations this copies the commands.properties file to /etc/cloudstack/management Signed-off-by: Rohit Yadav --- packaging/centos63/cloud.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index c8901a84d65..d72840b517a 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -447,6 +447,13 @@ if [ -d "%{_sysconfdir}/cloud" ] ; then mv %{_sysconfdir}/cloud %{_sysconfdir}/cloud.rpmsave fi +# in case of upgrade to 4.9+ copy commands.properties if not exists in /etc/cloudstack/management/ +if [ "$1" == "2" ] ; then + if [ -f "%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties" ] && [ ! -f "%{_sysconfdir}/%{name}/management/commands.properties" ] ; then + cp -p %{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/commands.properties %{_sysconfdir}/%{name}/management/commands.properties + fi +fi + %post management if [ "$1" == "1" ] ; then /sbin/chkconfig --add cloudstack-management > /dev/null 2>&1 || true