-
Notifications
You must be signed in to change notification settings - Fork 168
Allow to pass multiple policies in the cli #4948
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
Open
LecrisUT
wants to merge
1
commit into
teemtee:main
Choose a base branch
from
LecrisUT:feat/multi-policy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+33
−13
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -70,8 +70,8 @@ | |||||||||
|
|
||||||||||
|
|
||||||||||
| def _load_policies( | ||||||||||
| policy_name: Optional[str], | ||||||||||
| policy_path: Optional[Path], | ||||||||||
| policy_name: list[str], | ||||||||||
| policy_path: list[Path], | ||||||||||
|
Comment on lines
+73
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use
Suggested change
|
||||||||||
| policy_root: Optional[Path], | ||||||||||
| ) -> list[tmt.policy.Policy]: | ||||||||||
| """ | ||||||||||
|
|
@@ -85,30 +85,32 @@ def _load_policies( | |||||||||
| directory. | ||||||||||
| """ | ||||||||||
|
|
||||||||||
| if policy_name is not None: | ||||||||||
| if policy_name: | ||||||||||
| if policy_root is None: | ||||||||||
| raise GeneralError( | ||||||||||
| "Policy can be loaded by its name only when '--policy-root' is specified." | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| if policy_path is not None: | ||||||||||
| if policy_path: | ||||||||||
| raise GeneralError( | ||||||||||
| "Options '--policy-name' and '--policy-file' are mutually exclusive." | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| return [ | ||||||||||
| tmt.policy.Policy.load_by_name( | ||||||||||
| name=policy_name, | ||||||||||
| name=name, | ||||||||||
| root=policy_root, | ||||||||||
| ) | ||||||||||
| for name in policy_name | ||||||||||
| ] | ||||||||||
|
|
||||||||||
| if policy_path is not None: | ||||||||||
| if policy_path: | ||||||||||
| return [ | ||||||||||
| tmt.policy.Policy.load_by_filepath( | ||||||||||
| path=policy_path, | ||||||||||
| path=path, | ||||||||||
| root=policy_root, | ||||||||||
| ) | ||||||||||
| for path in policy_path | ||||||||||
| ] | ||||||||||
|
|
||||||||||
| return [] | ||||||||||
|
|
@@ -353,8 +355,8 @@ def run( | |||||||||
| context: Context, | ||||||||||
| id_: Optional[str], | ||||||||||
| workdir_root: Optional[Path], | ||||||||||
| policy_file: Optional[Path], | ||||||||||
| policy_name: Optional[str], | ||||||||||
| policy_file: list[Path], | ||||||||||
| policy_name: list[str], | ||||||||||
| policy_root: Optional[Path], | ||||||||||
| recipe: Optional[Path], | ||||||||||
| **kwargs: Any, | ||||||||||
|
|
@@ -964,8 +966,8 @@ def tests_export( | |||||||||
| nitrate: bool, | ||||||||||
| bugzilla: bool, | ||||||||||
| template: Optional[str], | ||||||||||
| policy_file: Optional[Path], | ||||||||||
| policy_name: Optional[str], | ||||||||||
| policy_file: list[Path], | ||||||||||
| policy_name: list[str], | ||||||||||
| policy_root: Optional[Path], | ||||||||||
| **kwargs: Any, | ||||||||||
| ) -> None: | ||||||||||
|
|
@@ -1227,8 +1229,8 @@ def plans_export( | |||||||||
| how: str, | ||||||||||
| format: str, | ||||||||||
| template: Optional[str], | ||||||||||
| policy_file: Optional[Path], | ||||||||||
| policy_name: Optional[str], | ||||||||||
| policy_file: list[Path], | ||||||||||
| policy_name: list[str], | ||||||||||
| policy_root: Optional[Path], | ||||||||||
| **kwargs: Any, | ||||||||||
| ) -> None: | ||||||||||
|
|
||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The assertion always passes because
yqexits with0even if the expression evaluates tofalse. Usegrepto verify the output value, similar to line 77.