Script: ru_magician.py
This script is provided as is with no guarantees.
This script is meant to be used on clusters deployed with Ambari and using Ambari version 2.0.0 or higher, in order to identify any inconsistencies in the database related to the version of components for the HDP stack. The script will pinpoint problems, and ask the user to take correct action to update their database. As of this version, this script only supports MySQL and Postgres.
It handles the following cases:
On a newly installed cluster, ensures that there is at least one cluster version whose state is CURRENT. If not, will advise the user to restart services.
If the user has Registered and Installed repositories, check that each one has a unique version and display name. Further, if any are stuck in an INSTALLING state, will let the user take three potential actions: leave as is, force to INSTALLED, force to INSTALL_FAILED (in order to retry).
If the user has Registered and Installed repositories, and one cluster_version is already in an UPGRADING state, perhaps because hdp-select changed the symlinks and a component was restarted, or the user inadvertently started a manual upgrade, will allow the user to force it back to INSTALLED.
If the user in the in the middle of an upgrade, and they want to force one of the versions are CURRENT, it will update all database records accordingly, and set the previously CURRENT version to INSTALLED.