From 57ba367f3c985e80ea1b34267e298b481a353298 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Thu, 7 Nov 2013 11:09:06 +0100 Subject: [PATCH] CLOUDSTACK-5042: change cloud.keystore to cloudmanagementserver.keystore and install it (cherry picked from commit de448ec4792eda5b47d79b26e9cb8ce96a2b22f4) --- ...r.keystore => cloudmanagementserver.keystore.in} | Bin debian/cloudstack-management.postinst | 5 ++++- packaging/centos63/cloud.spec | 10 +++++++++- .../com/cloud/server/ConfigurationServerImpl.java | 2 +- 4 files changed, 14 insertions(+), 3 deletions(-) rename client/tomcatconf/{cloudmanagementserver.keystore => cloudmanagementserver.keystore.in} (100%) diff --git a/client/tomcatconf/cloudmanagementserver.keystore b/client/tomcatconf/cloudmanagementserver.keystore.in similarity index 100% rename from client/tomcatconf/cloudmanagementserver.keystore rename to client/tomcatconf/cloudmanagementserver.keystore.in diff --git a/debian/cloudstack-management.postinst b/debian/cloudstack-management.postinst index a1219cc789f..8d99f6a1cce 100644 --- a/debian/cloudstack-management.postinst +++ b/debian/cloudstack-management.postinst @@ -35,7 +35,7 @@ if [ "$1" = configure ]; then OLDCONFDIR="/etc/cloud/management" NEWCONFDIR="/etc/cloudstack/management" - CONFFILES="db.properties cloud.keystore key" + CONFFILES="db.properties key" # Copy old configuration so the admin doesn't have to do that # Only do so when we are installing for the first time @@ -45,6 +45,9 @@ if [ "$1" = configure ]; then cp -a $OLDCONFDIR/$FILE $NEWCONFDIR/$FILE fi done + if [ -f "$OLDCONFDIR/cloud.keystore" ]; then + cp -a $OLDCONFDIR/cloud.keystore $NEWCONFDIR/cloudmanagementserver.keystore + fi fi chmod 0640 /etc/cloudstack/management/db.properties diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index ebe45113eb1..cd6ff4bfbe2 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -252,7 +252,7 @@ rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/cl rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/vms for name in db.properties log4j-cloud.xml tomcat6-nonssl.conf tomcat6-ssl.conf server-ssl.xml server-nonssl.xml \ - catalina.policy catalina.properties classpath.conf tomcat-users.xml web.xml environment.properties ; do + catalina.policy catalina.properties classpath.conf tomcat-users.xml web.xml environment.properties cloudmanagementserver.keystore ; do mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/$name \ ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name done @@ -450,6 +450,13 @@ else echo "Unable to determine ssl settings for tomcat.conf, please run cloudstack-setup-management manually" fi +if [ -f "%{_sysconfdir}/cloud.rpmsave/management/cloud.keystore" ]; then + mv %{_sysconfdir}/%{name}/management/cloudmanagementserver.keystore %{_sysconfdir}/%{name}/management/cloudmanagementserver.keystore.rpmnew + cp -p %{_sysconfdir}/cloud.rpmsave/management/cloud.keystore %{_sysconfdir}/%{name}/management/cloudmanagementserver.keystore + # make sure we only do this on the first install of this RPM, don't want to overwrite on a reinstall + mv %{_sysconfdir}/cloud.rpmsave/management/cloud.keystore %{_sysconfdir}/cloud.rpmsave/management/cloud.keystore.rpmsave +fi + %preun agent /sbin/service cloudstack-agent stop || true if [ "$1" == "0" ] ; then @@ -539,6 +546,7 @@ fi %config(noreplace) %{_sysconfdir}/%{name}/management/cloud-bridge.properties %config(noreplace) %{_sysconfdir}/%{name}/management/commons-logging.properties %config(noreplace) %{_sysconfdir}/%{name}/management/ec2-service.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/cloudmanagementserver.keystore %attr(0755,root,root) %{_initrddir}/%{name}-management %attr(0755,root,root) %{_bindir}/%{name}-setup-management %attr(0755,root,root) %{_bindir}/%{name}-update-xenserver-licenses diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 0676db8ca18..8459adafb13 100755 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -584,7 +584,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio File confFile = PropertiesUtil.findConfigFile("db.properties"); /* This line may throw a NPE, but that's due to fail to find db.properities, meant some bugs in the other places */ String confPath = confFile.getParent(); - String keystorePath = confPath + "/cloud.keystore"; + String keystorePath = confPath + "/cloudmanagementserver.keystore"; File keystoreFile = new File(keystorePath); boolean dbExisted = (dbString != null && !dbString.isEmpty());