'Install a host object with profile name defined by distro.
:param host: Autotest host object.
:param profile: String with cobbler profile name.
:param timeout: Amount of time to wait for the install.
:param num_attempts: Maximum number of install attempts.'

def install_host(self, host, profile='', timeout=None, num_attempts=2):

    if (not self.xmlrpc_url):
        return
    installations_attempted = 1
    step_time = 60
    if (timeout is None):
        timeout = 3600
    (system, system_handle) = self.get_system_handle(host)
    if (not profile):
        profile = self.server.get_system(system).get('profile')
    if (not profile):
        e_msg = ('Unable    to    determine    profile    for    host    %s' % host.hostname)
        raise error.HostInstallProfileError(e_msg)
    host.record('START', None, 'install', host.hostname)
    host.record('GOOD', None, 'install.start', host.hostname)
    logging.info('Installing    machine    %s    with    profile    %s    (timeout    %s    s)', host.hostname, profile, timeout)
    install_start = time.time()
    time_elapsed = 0
    install_successful = False
    while ((not install_successful) and (installations_attempted <= self.num_attempts) and (time_elapsed < timeout)):
        self._set_host_profile(host, profile)
        self.server.power_system(system_handle, 'reboot', self.token)
        installations_attempted += 1
        while (time_elapsed < timeout):
            time.sleep(step_time)
            if (not self.server.get_system(system).get('netboot_enabled')):
                logging.debug('Cobbler    got    signaled    that    host    %s    installation    is    finished', host.hostname)
                break
        installed_profile = self.server.get_system(system).get('profile')
        install_successful = (installed_profile == profile)
        if install_successful:
            logging.debug('Host    %s    installation    successful', host.hostname)
            break
        else:
            logging.info('Host    %s    installation    resulted    in    different    profile', host.hostname)
        time_elapsed = (time.time() - install_start)
    if (not install_successful):
        e_msg = ('Host    %s    install    timed    out' % host.hostname)
        host.record('END    FAIL', None, 'install', e_msg)
        self._disable_host_installation(host)
        raise error.HostInstallTimeoutError(e_msg)
    remove_hosts_file()
    host.wait_for_restart()
    host.record('END    GOOD', None, 'install', host.hostname)
    time_elapsed = (time.time() - install_start)
    logging.info('Machine    %s    installed    successfully    after    %d    s    (%d    min)', host.hostname, time_elapsed, (time_elapsed / 60))
