When trying to upgrade a user resource to a new bundle we get an error similar to:
Error: Template 'tre-service-guacamole-windowsvm' not found for resource type 'user-resource' with target template version '0.7.10'
this is as the following code in api_app/db/repositories/resource_templates.py
async def get_template_by_name_and_version(self, name: str, version: str, resource_type: ResourceType, parent_service_name: Optional[str] = None) -> Union[ResourceTemplate, UserResourceTemplate]:
"""
Returns full template for the 'resource_type' template defined by 'template_name' and 'version'
For UserResource templates, you also need to pass in 'parent_service_name' as a parameter
"""
query = self._template_by_name_query(name, resource_type) + f' AND c.version = "{version}"'
# If querying for a user resource, we also need to add the parentWorkspaceService (name) to the query
if resource_type == ResourceType.UserResource:
if parent_service_name:
query += f' AND c.parentWorkspaceService = "{parent_service_name}"'
else:
raise Exception("When getting a UserResource template, you must pass in a 'parent_service_name'")
As parent_service_name is being passed in as and ID rather than a name.
When trying to upgrade a user resource to a new bundle we get an error similar to:
this is as the following code in
api_app/db/repositories/resource_templates.pyAs
parent_service_nameis being passed in as and ID rather than a name.