Bulk update a component's statements across all systems #1797
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.
Stories
As an administrative user, I want to be able to update an existing component's description and implementation statements via the API so that I can maintain a component definition outside of GovReady-Q and automatically update component definition in GovReady-Q.
As an administrative user, I want to be able to propagate a change in a component's implementation statements to all all systems using that component, so that if I update a component definition I can have all systems consuming that component have their statements updated, too.
Update various Python and NPM libraries.
Discussion
Three changes were made to support updating components:
update
boolean parameter to theelements/createOSCAL
API v2 endpoint to indicate an existing component should be updated;Element.synch_consuming_systems_implementation_statements
method to force synchronize implementation statements of consuming systems; andelements/synchConsumingSystemsImplementationStatements
API v2 endpoint to trigger component to system synchronization via the API.Updating a component via the v2 API involves a two step process.
First, call the
element/createOSCAL
endpoint with the new OSCAL component definition and theupdate
parameter set to true. This will make the API update an existing component that matches by title (e.g., name) of the component if one exists. Settingupdate
to true will update the component that matches by name instead of creating a new component. Updating the component means that the component in the library will have its statements updated, new statements added, and removed statements deleted. Theelements/createOSCAL
endpoint only effects the component library, and not any of the control implementation statements associated with the component on individual systems. The updated OSCAL adds, removes, and updates statements.Second, call the
elements/synchConsumingSystemsImplementationStatements
endpoint using the component's ID in the database to synchronize the statements in the consuming systems. This API endpoint can be used at anytime to force synchronize TheElement.synch_consuming_systems_implementation_statements
method is called by the API. This enables the synchronization to be done.The released implementation force updates the component definition of all consuming systems.
Note that the update and synchronization method are compatible with maintaining a change history of each statement. However, a deleted statement and its history will simply disappear. There history of a statement being deleted.
Using
Use the Swagger API to test:
/api/v2/docs/swagger/ > elements/createOSCAL
/api/v2/docs/swagger/ > elements/synchConsumingSystemsImplementationStatements
Future improvements
Element.synch_consuming_systems_implementation_statements