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

cleanup: Allow for policy files to not specify projects #1103

Merged
merged 4 commits into from
Oct 4, 2023
Merged

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Oct 4, 2023

This makes it easier to create policies for self-registered users, since
they can simply do medic policy create -f <path to file> and mediator
will just adopt the default project for the user. To facilitate this, the PR
removes all project: (and leftover group: ) assignments in policies and rules,
so we can simply take them into use.

This also moves the policy validations to the validations.go file in our
API, since it makes things more predictable.

Finally, this removes the context validation, as it's not super useful and we anyway
check for this along the code-base.

This also adds the capability for medic policy create to take a command line flag
to overwrite the project being used for the policy.

Closes #1082

This makes it easier to create policies for self-registered users, since
they can simply do `medic policy create -f <path to file>` and mediator
will just adopt the default project for the user.

This also moves the policy validations to the `validations.go` file in our
API, since it makes things more predictable.

Finally, this removes the context validation, as it's not super useful and we anyway
check for this along the code-base.
@JAORMX JAORMX requested review from lukehinds, jhrozek, yrobla and rdimitrov and removed request for lukehinds and jhrozek October 4, 2023 12:32
This also removes the context validation test.
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

project-less policies now work as well as displaying their status, deleting. The code looks good to me, too!

@JAORMX JAORMX merged commit 46392f0 into main Oct 4, 2023
12 checks passed
@JAORMX JAORMX deleted the policy-easier branch October 4, 2023 12:51
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.

Project setting solely depends on the file for policy creating
2 participants