How to reproduce:
- Have your own MPack that is similar to one that is located at "contrib/management-packs/microsoft-r_mpack" in Ambari source code
- Have an Ambari Server 2.4.3 with the MPack installed in a cluster
- Upgrade Ambari-Server to 2.5.1 version
Ambari Server is upgraded and MPack is still installed and used
When running ambari-server upgrade, it fails with the following error message:
The following steps are used for Ambari-Server upgrade:
Usually when such a common service is installed from MPack, a new directory (named by the service) is created in /var/lib/ambari-server/resources/common-services/ directory. The service directory contain a single symbolic link (named by the version of the service) and targets /var/lib/ambari-server/resources/mpacks/<MY_MPACK_NAME>-<MY_MPACK_VERSION>/common-services/<MY_SERVICE_NAME>/<MY_SERVICE_VERSION>
It seems that the whole upgrade process works correctly until
command runs find_and_copy_custom_services function that re-creates common-services from the backup directory that is created during apt-get install ambari-server. The backup directory is correctly having the symbolic link in it while the newly created /var/lib/ambari-server/resources/common-services/ is NOT having the symbolic link. Instead it contains full-deep copy of the directory targeted by the original symbolic link.
Replace the following line in ambari-server/src/main/python/ambari_server/serverUpgrade.py:
so the service directory gets copied while keeping symbolic links.