Skip to content

(CAT-1731) add rules tests #81

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

Merged
merged 3 commits into from
Jun 6, 2024
Merged

(CAT-1731) add rules tests #81

merged 3 commits into from
Jun 6, 2024

Conversation

jonathannewman
Copy link
Contributor

Summary

Within the Puppet Enterprise UI console the concept of pinned nodes
allows more complex rules to be expressed while including pinned nodes.

Pinned nodes are formed by having a top level "or" clause, with
expressions in the form

['=', 'name', 'hostname']

Prior to this change, the code would not properly maintain pinned nodes,
nor correctly handle merging expressions like:

['and',
  ['~',
    ['fact', 'pe_server_version'],
    '.+']]

with

['or', ['~',
    ['trusted', 'extensions', '1.3.6.1.4.1.34380.1.1.9812'],
    '^puppet/']]

Incorrectly combining them into an and clause when logically they should be an "or" clause.

With this change, pinned nodes are separated our from the other rules
and then recombined later (if they are present) with a top-level "or" clause.

Test are added to demonstrate the behaviors.

Additional Context

Add any additional context about the problem here.

  • Root cause and the steps to reproduce. (If applicable)
  • Thought process behind the implementation.

Related Issues (if any)

Mention any related issues or pull requests.

Checklist

  • 🟢 Spec tests.

@jonathannewman jonathannewman requested a review from a team as a code owner May 28, 2024 15:50
@jonathannewman jonathannewman changed the title Cat 1731 add rules tests (CAT-1731) add rules tests May 28, 2024
Copy link
Contributor

@Ramesh7 Ramesh7 left a comment

Choose a reason for hiding this comment

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

lgtm

will be good if we can get second approval as I am not an expert on this module.

timidri and others added 3 commits June 6, 2024 21:13
remove extensions.json following ci complaints
Within the Puppet Enterprise UI console the concept of pinned nodes
allows more complex rules to be expressed while including pinned nodes.

Pinned nodes are formed by having a top level "or" clause, with
expressions in the form

`['=', 'name', 'hostname']`

Prior to this change, the code would not properly maintain pinned nodes,
nor correctly handle merging expressions like:

```
['and',
  ['~',
    ['fact', 'pe_server_version'],
    '.+']]
```

with
```
['or', ['~',
    ['trusted', 'extensions', '1.3.6.1.4.1.34380.1.1.9812'],
    '^puppet/']]
```

Incorrectly combining them into an `and` clause when logically they should be an "or" clause.

With this change, pinned nodes are separated our from the other rules
and then recombined later (if they are present) with a top-level "or" clause.

Test are added to demonstrate the behaviors.
@Ramesh7 Ramesh7 force-pushed the CAT-1731-add-rules-tests branch from 462b6bb to edeea19 Compare June 6, 2024 15:44
Copy link
Contributor

@steveax steveax left a comment

Choose a reason for hiding this comment

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

👍

@steveax steveax merged commit c066ae3 into main Jun 6, 2024
5 checks passed
@steveax steveax deleted the CAT-1731-add-rules-tests branch June 6, 2024 17:31
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.

4 participants