fixed: Promote_database only runs if db is a replica
What does this MR do?
Makes the promote_database code only run if the database is a replica, or trap the error about the database already being promoted, and return success.
Verification Steps
The code change was mostly verified with some refactoring, extracting the minimum possible from the file into a ruby module, to make it testable.
Related to #8220
Edited by Natanael Silva