From 8cd44b1684b41884f10f350318dc8130eb5b5f75 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 23 Aug 2016 17:20:41 +0530 Subject: [PATCH] CLOUDSTACK-9467: Add symlink to key file for usage server On fresh installation, the usage server fails to start if the `key` file does not exist in its classpath. The issue is reproducible in environments where the usage server is installed before cloudstack-setup-databases has been called. Before the cloudstack db has been setup, the key file does not exist at its default location and installation of usage-server fails to add a symlink to the key file. This fix adds a default symlink to `/etc/cloudstack/management/key` if a symlink/file does not already exist in the /etc/cloudstack/usage directory. On new installation, in the post-installation steps it checks if the symlink or file exists, and adds a symlink if it does not exist. On existing installations, if symlink or file exists then it will skip adding symlink. Signed-off-by: Rohit Yadav --- packaging/centos63/cloud.spec | 4 ++++ packaging/centos7/cloud.spec | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index 6458c3d610d..fd02157fc44 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -552,6 +552,10 @@ if [ -f "%{_sysconfdir}/%{name}/management/key" ]; then ln -s %{_sysconfdir}/%{name}/management/key %{_sysconfdir}/%{name}/usage/key fi +if [ ! -f "%{_sysconfdir}/%{name}/usage/key" ]; then + ln -s %{_sysconfdir}/%{name}/management/key %{_sysconfdir}/%{name}/usage/key +fi + %post marvin pip install --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz diff --git a/packaging/centos7/cloud.spec b/packaging/centos7/cloud.spec index bee22e9f2cc..3917a053fa0 100644 --- a/packaging/centos7/cloud.spec +++ b/packaging/centos7/cloud.spec @@ -449,6 +449,10 @@ if [ -f "%{_sysconfdir}/%{name}/management/key" ]; then ln -s %{_sysconfdir}/%{name}/management/key %{_sysconfdir}/%{name}/usage/key fi +if [ ! -f "%{_sysconfdir}/%{name}/usage/key" ]; then + ln -s %{_sysconfdir}/%{name}/management/key %{_sysconfdir}/%{name}/usage/key +fi + %post marvin pip install --upgrade http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip#md5=3df394d89300db95163f17c843ef49df pip install --upgrade /usr/share/cloudstack-marvin/Marvin-*.tar.gz