-
Notifications
You must be signed in to change notification settings - Fork 85
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
Support 'export' option #267
Closed
Closed
Conversation
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
Output can be to stdout or named file. Output format supports JSON and YAML JSON output required quite a few hacks (YAML worked smoothly out of the box). The problem is that MarshalJSON on the interfaces (such as Component) simply failed due to UnsupportedType error (with no clue as to which type was the problem). I ended up with helper functions to work around the problem, but hopefully done in such a way that updates to the schema will require only minimal changes. Specifically, 'lib/certifications/certification.go' has a helper function to take Certification interface and coerce it into a specific type; from that point, JSON output worked as expected.
Coalesces all controls for a given identified prefix (e.g. 'AC-2 (9)') into a deterministic location in the generated JSON. Example: Control Prefix: 'data:components:RHEL7:satisfies:AC-2 (9)' -> becomes: 'controls:AC-2 (9)' All subelements are included in the normalized keyset; e.g. 'data:components:RHEL7:satisfies:AC-2 (9):control_key' becomes 'controls:AC-2 (9):control_key'. This makes it possible to create output Word documents with replaceable text that will not be affected by the sourced component.
Related export function groups go into their own dedicated source file.
1. Explicitly install golint in Makefile 2. Do not infer --verbose for --debug
Removed the extraneous output from export tests. |
@andybrucenet not sure if you're still interested, but would be great to see this PR rebased. Lots of great capability in this! |
redhatrises
added a commit
to redhatrises/compliance-masonry
that referenced
this pull request
Jun 11, 2018
- Fixes opencontrol#267
Merged
redhatrises
added a commit
to redhatrises/compliance-masonry
that referenced
this pull request
Jun 11, 2018
- Fixes opencontrol#267
redhatrises
added a commit
to redhatrises/compliance-masonry
that referenced
this pull request
Jun 11, 2018
- Fixes opencontrol#267
Hi @andybrucenet - Much of this was incorporated into #292. What do you think? Should export be extended further? Going to close this PR for now. New ones that extend |
redhatrises
added a commit
to redhatrises/compliance-masonry
that referenced
this pull request
Jun 11, 2018
- Fixes opencontrol#267
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Goal: Output from
compliance-masonry
can be pipelined into a toolchain such asdocxtemplater
.Process:
compliance
folder containingopencontrols.yaml
, local policies, possibly local copy of SSP Template to use."Flatten" Notes:
The
export
command supports--flattened
- so what does that mean? Basically, consider that a project could include components like RHEL7, OpenShift-v3, as well as project-specific (e.g. AU_policy component). In the generated output, the satisfied controls narratives / properties are located under the specific component (e.g. AC-2 (9) perhaps under RHEL7, AU-3 maybe under OpenShift-v3, and possibly AU-1 under local AU_policy component). This makes setting up a generic SSP Word template impossible, because there is no way to know a priori what flattened key a specific satisfied control would have. To handle this, theexport
verb looks for all satisfied controls and builds some meta-control definitions likecontrols:AU-1:XXX
where theXXX
is simply all the attributes stolen from the appropriate compliance-masonry output.Hope this is a useful idea / PR!