Enable the root account on the remote host.


        Since the host may have been deployed using a Cloud image, it may not
        be possible to use the 'root' account. This method ensure the root
        account is enable, if this is not the case, it will try to get the name
        of admin user and use it to re-enable the root account.

def enable_user(self, user):
        """Enable the root account on the remote host.


        Since the host may have been deployed using a Cloud image, it may not
        be possible to use the 'root' account. This method ensure the root
        account is enable, if this is not the case, it will try to get the name
        of admin user and use it to re-enable the root account.
        """
        if user in self.ssh_pool._ssh_clients:
            return

        if user == 'root':
            _root_ssh_client = ssh.SshClient(
                hostname=self.hostname,
                user='root',
                key_filename=self._key_filename,
                via_ip=self.via_ip)

            # connect as a root user
            _root_ssh_client.start()
            result, _ = _root_ssh_client.run('uname -a')

            image_user = None
            # check if root is not allowed
            if 'Please login as the user "cloud-user"' in result:
                image_user = 'cloud-user'
                _root_ssh_client.stop()
            elif 'Please login as the user "fedora" rather than the user "root"' in result:
                image_user = 'fedora'
                _root_ssh_client.stop()
            elif 'Please login as the user "centos" rather than the user "root"' in result:
                image_user = 'centos'
                _root_ssh_client.stop()

            if image_user:
                self.enable_user(image_user)
                LOG.info('enabling the root user')
                _cmd = "sudo sed -i 's,.*ssh-rsa,ssh-rsa,' /root/.ssh/authorized_keys"
                self.ssh_pool.run(image_user, _cmd)
                _root_ssh_client.start()
            self.ssh_pool.add_ssh_client('root', _root_ssh_client)
            return

        # add the cloud user to the ssh pool
        self.ssh_pool.build_ssh_client(
            hostname=self.hostname,
            user=user,
            key_filename=self._key_filename,
            via_ip=self.via_ip)