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

feat: add parameter value origin field to parameters #1470

Merged
merged 27 commits into from
Dec 22, 2023

Conversation

AleJo2995
Copy link
Collaborator

Types of changes

  • Hot fix (emergency fix and release)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Documentation (change which affects the documentation site)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Release (develop -> main)

Quality assurance (all should be covered).

  • My code follows the code style of this project.
  • Documentation for my change is up to date?
  • My PR meets testing requirements.
  • All new and existing tests passed.
  • All commits are signed-off.

Summary

Closes #1454

Key links:

Before you merge

  • Ensure it is a 'squash commit' if not a release.
  • Ensure CI is currently passing
  • Check sonar. If you are working for a fork a maintainer will reach out, if required.

@AleJo2995 AleJo2995 marked this pull request as ready for review October 24, 2023 02:04
Copy link
Collaborator

@vikas-agarwal76 vikas-agarwal76 left a comment

Choose a reason for hiding this comment

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

Need to discuss.

@@ -1626,6 +1626,7 @@ class Config:
values: Optional[List[constr(regex=r'^\S(.*\S)?$')]] = Field(None)
select: Optional[ParameterSelection] = None
remarks: Optional[str] = None
param_value_origin: Optional[str] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is wrong. We are not adding a field directly to param origin in OSCAL. We are just adding a property. So OSCAL schema should not be changed.

@@ -106,6 +106,7 @@ class Config:
guidelines: Optional[List[common.ParameterGuideline]] = Field(None)
values: Optional[List[constr(regex=r'^\S(.*\S)?$')]] = Field(None)
select: Optional[common.ParameterSelection] = None
param_value_origin: Optional[str] = Field(None, alias='parameter-value-origin')

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is wrong. We are not changing the schema.

new_dict[const.PARAM_VALUE_ORIGIN] = param_value_origin
else:
# puts it empty for user to fill it out mandatorily
new_dict[const.PARAM_VALUE_ORIGIN] = 'Added by Control Owner'
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This value needs to be changed after Prashant confims which is the default value for the field. @vikas-agarwal76 . In the meantime I'm using a placeholder value

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it required to populate the value for param value origin?


# convert resolved profile catalog to markdown then assemble it after adding an item to a control
# generate, edit, assemble
test_args = f'trestle author profile-generate -n {assembled_prof_name} -o {md_name} -rs NeededExtra --force-overwrite'.split( # noqa E501
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Test includes overwrite of the profile at the end to proof that the markdown gets modified after a profile json is modified as well for param_value_origin prop

@AleJo2995
Copy link
Collaborator Author

@vikas-agarwal76 after profile assemble, the prop for param_value_origin will look like this:

image

Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
Copy link
Collaborator

@vikas-agarwal76 vikas-agarwal76 left a comment

Choose a reason for hiding this comment

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

I didn't find any changes to profile code and Mardkown code for reading and writing param value origin. Where are those changes. Also if the param-value-origin was set in previous catalog or profile then how will you distinguish whether it wa set in this profile or pervious profile for including in profile->alters->set-params?

new_dict[const.PARAM_VALUE_ORIGIN] = param_value_origin
else:
# puts it empty for user to fill it out mandatorily
new_dict[const.PARAM_VALUE_ORIGIN] = 'Added by Control Owner'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it required to populate the value for param value origin?

Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
@AleJo2995
Copy link
Collaborator Author

@vikas-agarwal76 done. I have added the new test required for testing the inherited param-value-origin coming from another profile called: test_param_value_origin_from_inherited_profile

… in profile-param-value-origin

Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
@AleJo2995
Copy link
Collaborator Author

@vikas-agarwal76 , @mrgadgil I have changed the default value for param-value-origin correctly. Could you please approve so I can merge? Thanks

Signed-off-by: Alejandro Jose Leiva Palomo <alejandro.leiva.palomo@ibm.com>
@AleJo2995 AleJo2995 enabled auto-merge (squash) December 21, 2023 19:57
Copy link
Collaborator

@vikas-agarwal76 vikas-agarwal76 left a comment

Choose a reason for hiding this comment

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

LGTM for param-value-origin
@AleJo2995 Please open another issue and PR to fix the param-values issue that we discussed.

@AleJo2995 AleJo2995 merged commit b86aa2b into develop Dec 22, 2023
15 checks passed
@AleJo2995 AleJo2995 deleted the fix/record-aditional-info branch December 22, 2023 15:11
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.

New property to record additional info when control owners update parameter values
3 participants