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

CRAYSAT-1917: Fix jinja2 rendering of boot_sets data in sat bootprep #280

Merged
merged 4 commits into from
Nov 6, 2024

Conversation

annapoorna-s-alt
Copy link
Contributor

@annapoorna-s-alt annapoorna-s-alt commented Oct 30, 2024

Summary and Scope

Make the following fixes:

  • Remove the boot_set property from BaseInputItem. It is not appropriate there, and it is redundant with boot_sets property that already exists in the InputSessionTemplate
  • Modify the jinja_rendered decorator to recursively render more complex objects like lists and dictionaries. I think this is safe, but we should consider any edge cases more carefully.
  • Remove the now unnecessary code that does a one-off Jinja2 rendering of rootfs_provider_passthrough in the boot_sets.

Could still use unit test enhancements that test this new ability to render fields in the boot_sets.

Issues and Related PRs

List and characterize relationship to Jira/Github issues and other pull requests. Be sure to list dependencies.

Testing

List the environments in which these changes were tested.

Tested on:

  • starlord

Test description:

How were the changes tested and success verified? If schema changes were part of this change, how were those handled in your upgrade/downgrade testing?

Tested on a simple bootprep input file that used a variable in the rootfs_provider_passthrough field of a boot set in a BOS session template.

Risks and Mitigations

Low

Pull Request Checklist

  • Version number(s) incremented, if applicable
  • Copyrights updated
  • License file intact
  • Target branch correct
  • CHANGELOG.md updated
  • Testing is appropriate and complete, if applicable
  • HPC Product Announcement prepared, if applicable

@annapoorna-s-alt
Copy link
Contributor Author

@annapoorna-s-alt
Copy link
Contributor Author

Adding unit tests are pending

@shivaprasad-metimath
Copy link
Contributor

Core functionality is tested. Need to update the unit tests for the same.

@annapoorna-s-alt - Would take the ticket forward, as she has tested the draft PR

Copy link
Contributor

@haasken-hpe haasken-hpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far, and testing output looks good. I suggested to Annapoorna that she could also test that other fields in the boot_sets support Jinja2 rendering since this has been added by the changes to jinja_rendered.

I will review again once that testing is done and once unit tests are added.

@annapoorna-s-alt
Copy link
Contributor Author

Output of testing other fields in the boot_sets support Jinja2 rendering - https://gist.github.com/annapoorna-s-alt/981715de25d248527c7200d50398c731#file-expand-other-fields-with-jinja

Make the following fixes:

- Remove the `boot_set` property from `BaseInputItem`. It is not appropriate
  there, and it is redundant with `boot_sets` property that already exists in
  the `InputSessionTemplate`
- Modify the `jinja_rendered` decorator to recursively render more complex
  objects like lists and dictionaries. I think this is safe, but we should
  consider any edge cases more carefully.
- Remove the now unnecessary code that does a one-off Jinja2 rendering of
  `rootfs_provider_passthrough` in the `boot_sets`.

Could still use unit test enhancements that test this new ability to render
fields in the boot_sets.

Test Description:
Tested on a simple bootprep input file that used a variable in the
`rootfs_provider_passthrough` field of a boot set in a BOS session template.
@annapoorna-s-alt annapoorna-s-alt requested review from vinanti-p and removed request for shivaprasad-metimath November 5, 2024 06:55
Add unit tests for usage of the `jinja_rendered` decorator on properties
of the `BaseInputItem`.

Modify these unit tests to simplify them slightly and to ensure that the
`SomeTestItem` class calls the `BaseInputItem` constructor, so that it
sets the `jinja_env` instance attribute, which is used by the
`jinja_rendered` decorator.

Test Description:
Unit tests pass.
Copy link
Contributor

@haasken-hpe haasken-hpe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added unit test does not test jinja_rendered, which is what is being changed. I have opened a PR to this branch to add such unit tests. Please take a look: #282

@haasken-hpe
Copy link
Contributor

Output of testing other fields in the boot_sets support Jinja2 rendering - https://gist.github.com/annapoorna-s-alt/981715de25d248527c7200d50398c731#file-expand-other-fields-with-jinja

This testing looks good.

haasken-hpe and others added 2 commits November 6, 2024 08:28
Update the unit tests of the InputSessionTemplate class to include tests
that check for proper Jinja2 template rendering of the boot_sets field.
…-unit-tests

CRAYSAT-1917: Add unit tests for `jinja_rendered` decorator
@annapoorna-s-alt annapoorna-s-alt merged commit 663015b into main Nov 6, 2024
3 checks passed
@annapoorna-s-alt annapoorna-s-alt deleted the CRAYSAT-1917-fix-jinja2-rendering branch November 6, 2024 15:19
@annapoorna-s-alt
Copy link
Contributor Author

/backport release/3.32

Copy link

Backporting into branch release/3.32 was successful. New PR: #284

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants