-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add uniqueness for Template Units id (BugFix) #951
Commits on Jan 18, 2024
-
Make sure Template units are units with id
A Template unit always contains an id field. It should therefore inherit UnitWithId instead of Unit, so that the `partial_id()` and `id()` methods are inherited as well.
Configuration menu - View commit details
-
Copy full SHA for d8c38cf - Browse repository at this point
Copy the full SHA d8c38cfView commit details -
Prevent Template Units id from being rendered when using Jinja2
By default, templates using Jinja2 engine gets their id rendered as soon as they get accessed, but since they don't have the appropriate environment, the parameters are replaced with an empty string. This is why when you run the command `checkbox-cli list template`, you may see things like this: template 'com.canonical.certification::camera/still_' instead of template 'com.canonical.certification::camera/still_{{ name }}' Note that this does not happen with standard Python formatted strings: template 'com.canonical.certification::camera/led_{name}' In order to make the behavior consistent regardless of the template engine used, this commit: - introduces a unit property that always returns "template" (similar to how the Job unit always returns "job"). - modifies Unit.get_record_value() to prevent rendering using Jinja2 templating if the unit is a Checkbox Template It also contains unit tests for both the TemplateUnit and its Validator.
Configuration menu - View commit details
-
Copy full SHA for 81c9535 - Browse repository at this point
Copy the full SHA 81c9535View commit details
Commits on Jan 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 6f6cd46 - Browse repository at this point
Copy the full SHA 6f6cd46View commit details -
Expose Template Unit's template-id field instead of id
PlainBoxObject is used when exposing Units at a high level; for instance, when running `checkbox-cli list template`. Instead of exposing the Template Unit's id field, expose the template-id field.
Configuration menu - View commit details
-
Copy full SHA for ff727fe - Browse repository at this point
Copy the full SHA ff727feView commit details -
Use Template partial_id and id, similar to Job's partial_id and id
In order to have more granularity on what is displayed for the template id, use methods similar to the Job Unit.
Configuration menu - View commit details
-
Copy full SHA for 450b83c - Browse repository at this point
Copy the full SHA 450b83cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0ddf125 - Browse repository at this point
Copy the full SHA 0ddf125View commit details -
Implement explain() in TemplateUnit
This method overrides UnitWithId.explain() which displays the Unit's id. In the case of a Template, this is misleading, and the template_id (or, in this case, template_partial_id to prevent displaying the provider namespace) should be used instead. This is useful when reporting errors using `./manage.py validate`, for instance.
Configuration menu - View commit details
-
Copy full SHA for 2660fab - Browse repository at this point
Copy the full SHA 2660fabView commit details -
Configuration menu - View commit details
-
Copy full SHA for c24537d - Browse repository at this point
Copy the full SHA c24537dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 0e3d22d - Browse repository at this point
Copy the full SHA 0e3d22dView commit details