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

Add _translate_constraint_by_config function #2967

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

skycastlelily
Copy link
Collaborator

@skycastlelily skycastlelily commented May 29, 2024

Pull Request Checklist

  • implement the feature
  • write the documentation
  • extend the test coverage
  • update the specification
  • adjust plugin docstring
  • modify the json schema
  • mention the version
  • include a release note

@skycastlelily
Copy link
Collaborator Author

skycastlelily commented May 29, 2024

This MR looks at config file and tries to find a "translation" that would match the constraint, operator, value, and if found, it'd take it from configuration,we will need this to translate some complex or containing-internal-information constrains :)

@skycastlelily
Copy link
Collaborator Author

skycastlelily commented Jun 3, 2024 via email

@skycastlelily
Copy link
Collaborator Author

Updated^^

if not hardware_config:
return None

return hardware_config.hardware_config
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • I'd recommend returning an empty list, it's as false-ish as None
  • is it necessary to capture there exceptions, and then either reraise, or silence it? MetadataError should be heard as loudly as SpecificationError.

I think this could be simplified (plus "custom config" can mean anything, we're speaking about "translations" of constraints directly to Beaker XML):

def _get_constraint_translations() -> list[Translate]:
    config = tmt.config.Config()

    return config.hardware.translations if config.hardware else []

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

is it necessary to capture there exceptions, and then either reraise, or silence it? MetadataError should be heard as loudly as SpecificationError

We don't want to raise an error if there is no config tree,right ? so ,they should be handled differently.WDYT? :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Aha, I forgot it's still raising MetadataError - it will not if my https://github.com/teemtee/tmt/pull/3519/files#diff-c4acf376ac31d8918aa707c285892dd693fe71005eb4412bbfa4eb1273511f71R94 gets merged.

@skycastlelily
Copy link
Collaborator Author

Thanks for your super quick response,and pretty valuable suggestions, updated accordingly^^

@psss psss added this to the 1.45 milestone Mar 13, 2025
@psss psss added priority | should medium priority, should be included in the next release area | hardware Implementation of hardware requirements labels Mar 13, 2025
@happz happz added the ci | full test Pull request is ready for the full test execution label Mar 20, 2025
@happz
Copy link
Collaborator

happz commented Mar 20, 2025

Adding blocked, to get #3519 merged first as it simplifies some pieces of configuration handling.

@happz happz added the status | blocked The merging of PR is blocked on some other issue label Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area | hardware Implementation of hardware requirements ci | full test Pull request is ready for the full test execution priority | should medium priority, should be included in the next release status | blocked The merging of PR is blocked on some other issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants