<commit_before>module TemplateOperations
  def fillin_template_for_service_def(service_hash)
    return false unless check_service_hash(service_hash)
    service_def =  SoftwareServiceDefinition.find(service_hash[:type_path], service_hash[:publisher_namespace])
    container = loadManagedEngine(service_hash[:parent_engine])
    if container == false
      log_error_mesg('container load error', service_hash)
    else
      SystemDebug.debug(SystemDebug.templater,  :filling_in_template_on, container.container_name)
    end
    templater = Templater.new(SystemAccess.new, container)
    templater.fill_in_service_def_values(service_def)
    #FIXME make service_handle_field unique

    return service_def
  rescue StandardError => e
    p service_hash
    p service_def
    log_exception(e)
  end

  def get_resolved_string(env_value)

    templater = Templater.new(SystemAccess.new,nil)
    env_value = templater.apply_system_variables(env_value)
    return env_value
  rescue StandardError => e

    log_exception(e)
  end
  
  def get_resolved_engine_string(env_value, container)
    templater = Templater.new(SystemAccess.new,container)
        value = templater.apply_system_variables(env_value)
    SystemDebug.debug(SystemDebug.templater,  ' get_resolved_engine_string ' + value.to_s + 'from ', env_value)
        return value
      rescue StandardError => e
    
        log_exception(e,env_value,container)
  
  end
  
end<commit_msg>apply_build_variables not system for first run url<commit_after>module TemplateOperations
  def fillin_template_for_service_def(service_hash)
    return false unless check_service_hash(service_hash)
    service_def =  SoftwareServiceDefinition.find(service_hash[:type_path], service_hash[:publisher_namespace])
    container = loadManagedEngine(service_hash[:parent_engine])
    if container == false
      log_error_mesg('container load error', service_hash)
    else
      SystemDebug.debug(SystemDebug.templater,  :filling_in_template_on, container.container_name)
    end
    templater = Templater.new(SystemAccess.new, container)
    templater.fill_in_service_def_values(service_def)
    #FIXME make service_handle_field unique

    return service_def
  rescue StandardError => e
    p service_hash
    p service_def
    log_exception(e)
  end

  def get_resolved_string(env_value)

    templater = Templater.new(SystemAccess.new,nil)
    env_value = templater.apply_system_variables(env_value)
    return env_value
  rescue StandardError => e

    log_exception(e)
  end
  
  def get_resolved_engine_string(env_value, container)
    templater = Templater.new(SystemAccess.new,container)
        value = templater.apply_build_variables(env_value)
    SystemDebug.debug(SystemDebug.templater,  ' get_resolved_engine_string ' + value.to_s + 'from ', env_value)
        return value
      rescue StandardError => e
    
        log_exception(e,env_value,container)
  
  end
  
end
{'fraction_non_alphanumeric': 0.06898907103825136, 'fraction_numerical': 0.0, 'mean_word_length': 4.4953095684803, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '10397', 'n_tokens_mistral': 893, 'n_tokens_neox': 902, 'n_words': 159}