-
Notifications
You must be signed in to change notification settings - Fork 35
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
Updated verify_policy
tool
#7142
Open
alxmrs
wants to merge
5
commits into
PolymerLabs:master
Choose a base branch
from
alxmrs:policy-scratch
base: master
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.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
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
Next
Next commit
Updated VerifyPolicy
- Added flag to turn on debug mode. - made CLI more conventional - documented tool - added a few more log stmts
- Loading branch information
commit ec36bd6c7f5c5c39b2ad483a757668554b90b6d9
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
|
@@ -4,21 +4,30 @@ import arcs.core.analysis.PolicyVerifier | |
import arcs.core.data.proto.ManifestProto | ||
import arcs.core.data.proto.decodeRecipes | ||
import arcs.core.policy.proto.decode | ||
import arcs.core.util.Log | ||
import com.github.ajalt.clikt.core.CliktCommand | ||
import com.github.ajalt.clikt.core.CliktError | ||
import com.github.ajalt.clikt.parameters.arguments.argument | ||
import com.github.ajalt.clikt.parameters.options.flag | ||
import com.github.ajalt.clikt.parameters.options.option | ||
import com.github.ajalt.clikt.parameters.options.required | ||
import com.github.ajalt.clikt.parameters.types.file | ||
|
||
class VerifyPolicy : CliktCommand( | ||
name = "verify_policy", | ||
help = "Verifies that all recipes in an Arcs manifest file comply with their policies." | ||
help = "Verifies that all recipes in an Arcs manifest file comply with their policies.", | ||
printHelpOnEmptyArgs = true | ||
) { | ||
val manifest by option( | ||
val manifest by argument( | ||
help = "Arcs manifest to check, encoded as a binary proto file (.binarypb)" | ||
).file().required() | ||
).file() | ||
|
||
val debug by option("-d", "--debug", help = "Turn on debug tracing") | ||
.flag(default = false) | ||
|
||
override fun run() { | ||
if (debug) { | ||
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. Thanks for doing this! 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. My pleasure! |
||
Log.level = Log.Level.Debug | ||
} | ||
val manifestProto = ManifestProto.parseFrom(manifest.readBytes()) | ||
|
||
val recipes = manifestProto.decodeRecipes() | ||
|
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.
This is too much debug information. Let us not keep these log.debug statements.
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.
Sure thing, just pushed a reversion.