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

Update _do_enforcements from base_planning_svc.py #2577

Merged
merged 3 commits into from Aug 9, 2022

Conversation

pierregi
Copy link
Contributor

@pierregi pierregi commented May 12, 2022

Description

Update _do_enforcements so it does enforcement for all the items on the list of requirements of every module and not only on the first one of each module.
On the ability file, relationship_match is a list but, on _do_enforcements only the first item is tested. With this modification all of the list will be tested one relationship by one.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

I self tested running ability with requirements with multiple relationship_match.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

updating _do_enforcements so it test all the list of requirments of a module and not only the first one
@pierregi pierregi requested a review from a team as a code owner May 12, 2022 15:27
@github-actions
Copy link

github-actions bot commented Jun 2, 2022

This issue is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 5 days

@github-actions github-actions bot closed this Jun 12, 2022
@clenk clenk reopened this Aug 4, 2022
Copy link
Contributor

@clenk clenk left a comment

Choose a reason for hiding this comment

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

This is a good change. It allows requirements that use the same module to be specified in the yaml like

  requirements:
    - plugins.stockpile.app.requirements.basic:
      - source: foo
        edge: has_bar
        target: fizz
      - source: fizz
        edge: has_buzz
        target: foo

instead of

  requirements:
    - plugins.stockpile.app.requirements.basic:
      - source: foo
        edge: has_bar
        target: fizz
    - plugins.stockpile.app.requirements.basic:
      - source: fizz
        edge: has_buzz
        target: foo

I tested with both yaml styles before and after the proposed change, and confirmed that the change works as expected.

I do not think the test errors/warnings are related to the changes in this PR as they are also present on other PRs.

@clenk clenk requested a review from elegantmoose August 4, 2022 17:35
Copy link
Contributor

@elegantmoose elegantmoose 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 @pierregi

@elegantmoose
Copy link
Contributor

Yea its the CI pipeline complaining bc the PR is from an external branch.

@elegantmoose elegantmoose merged commit 29d12fc into mitre:master Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants