Move warning out of resolve_template_path function so that inherited function,e.g. like in ayon-houdini can continue without having tons of logs that are irrelevant if houdini specific logic could still resolve it.

This commit is contained in:
Roy Nieterau 2025-06-11 19:36:37 +02:00
parent 706d72f045
commit b523aa6b9f

View file

@ -878,8 +878,9 @@ class AbstractTemplateBuilder(ABC):
resolved_path = self.resolve_template_path(path)
if not resolved_path or not os.path.exists(resolved_path):
raise TemplateNotFound(
f"Template path '{path}' does not resolve to a valid existing "
"template file on disk."
"Template file found in AYON settings for task '{}' with host "
"'{}' does not exists. (Not found : {})".format(
task_name, host_name, resolved_path)
)
self.log.info(f"Found template at: '{resolved_path}'")
@ -928,17 +929,6 @@ class AbstractTemplateBuilder(ABC):
# This is a special case where the path is an AYON entity URI
# We need to resolve it to a filesystem path
resolved_path = resolve_entity_uri(path)
if not os.path.exists(resolved_path):
self.log.warning(
"Template found in AYON settings for task '{}' with host "
"'{}' does not resolve AYON entity URI '{}' "
"to an existing file on disk: '{}'".format(
self.current_task_name,
self.host_name,
path,
resolved_path,
)
)
return resolved_path
# If the path is set and it's found on disk, return it directly
@ -984,11 +974,6 @@ class AbstractTemplateBuilder(ABC):
solved_path = os.path.normpath(solved_path)
if not os.path.exists(solved_path):
self.log.warning(
"Template found in AYON settings for task '{}' with host "
"'{}' does not exists. (Not found : {})".format(
task_name, host_name, solved_path)
)
return path
result = StringTemplate.format_template(path, fill_data)
@ -996,9 +981,6 @@ class AbstractTemplateBuilder(ABC):
path = result.normalized()
return path
self.log.warning(
f"Unable to resolve template path: '{path}'"
)
return path
def emit_event(self, topic, data=None, source=None) -> Event: