Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot upgrade user reources #3824

Closed
marrobi opened this issue Jan 11, 2024 · 0 comments · Fixed by #3825
Closed

Cannot upgrade user reources #3824

marrobi opened this issue Jan 11, 2024 · 0 comments · Fixed by #3825
Assignees
Labels
bug Something isn't working

Comments

@marrobi
Copy link
Member

marrobi commented Jan 11, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant