'Implements the BaseBomValidateDeployer interface.'

def do_deploy(self, script, files_to_upload):

    options = self.options
    ensure_empty_ssh_key(self.__ssh_key_path, self.hal_user)
    script_parts = []
    for path in files_to_upload:
        filename = os.path.basename(path)
        script_parts.append('sudo    chmod    600    {file}'.format(file=filename))
        script_parts.append('sudo    chown    {user}:{user}    {file}'.format(user=self.hal_user, file=filename))
    script_parts.extend(script)
    script_path = write_script_to_path(script_parts, path=None)
    files_to_upload.add(script_path)
    if options.jenkins_master_name:
        write_data_to_secure_path(os.environ.get('JENKINS_MASTER_PASSWORD'), path=os.path.join(os.sep, 'tmp', 'jenkins_{name}_password'.format(name=options.jenkins_master_name)), is_script=True)
    try:
        self.do_create_vm(options)
        copy_files = 'scp    -i    {ssh_key_path}    -o    StrictHostKeyChecking=no    -o    UserKnownHostsFile=/dev/null    {files}    {user}@{ip}:~'.format(ssh_key_path=self.__ssh_key_path, files='    '.join(files_to_upload), user=self.hal_user, ip=self.instance_ip)
        logging.info('Copying    files    %s', copy_files)
        for retry in range(0, 10):
            result = run_quick(copy_files)
            if (result.returncode == 0):
                break
            time.sleep(2)
        if (result.returncode != 0):
            check_run_quick(copy_files)
    except Exception as ex:
        logging.error('Caught    %s', ex)
        raise
    finally:
        os.remove(script_path)
    try:
        logging.info('Waiting    for    ssh...')
        end_time = (time.time() + 30)
        logging.info('Entering    while    %f    <    %f', time.time(), end_time)
        while (time.time() < end_time):
            logging.info('Running    quick...')
            ready_response = run_quick('ssh    -i    {ssh_key}    -o    StrictHostKeyChecking=no    -o    UserKnownHostsFile=/dev/null    {user}@{ip}    "exit    0"'.format(user=self.hal_user, ip=self.instance_ip, ssh_key=self.__ssh_key_path), echo=False)
            logging.info('got    %s', ready_response)
            if (ready_response.returncode == 0):
                logging.info('ssh    is    ready.')
                break
            logging.info('ssh    not    yet    ready...')
            time.sleep(1)
        logging.info('Running    install    script')
        check_run_and_monitor('ssh    -i    {ssh_key}    -o    StrictHostKeyChecking=no    -o    UserKnownHostsFile=/dev/null    {user}@{ip}    ./{script_name}'.format(user=self.hal_user, ip=self.instance_ip, ssh_key=self.__ssh_key_path, script_name=os.path.basename(script_path)))
    except RuntimeError as error:
        logging.error('Caught    runtime    error:    %s', error)
        raise RuntimeError('Halyard    deployment    failed.')
    except Exception as ex:
        print str(ex)
        logging.exception('Unexpected    exception:    %s', ex)
        raise
