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

Add a check around default-cr (apply) to check to ensure the JSON is properly embedded in a "data" named element. #9

Merged
merged 1 commit into from
Jun 10, 2021

Conversation

RileyMcCuen
Copy link
Contributor

@RileyMcCuen RileyMcCuen commented Jun 7, 2021

Description

Added a validation around user input to the splicectl apply default-cr command. The input specified by --file will now be validated for a top level 'data' element. No actual validation of the contents of the data element occurs, only the verification that it exists and that there is no 'data' element as its immediate child, which would likely indicate an accidental double nesting of the default-cr.

Motivation and Context

This will prevent the passing of some potentially invalid default-crs to the splicectl/api and serve as an early warning that the input file is invalid. Specific errors are returned based on what splicectl is able to identify is wrong with the input, which should help users be able to quickly identify and fix their issue.

See DBAAS-5601

Dependencies

How Has This Been Tested?

A test case for each unique type of error that is to be expected has been created and exists in the apply_test.TestValidateDefaultCR() function. I also manually tested this with the splicectl tool on a live db as well and get the expected errors when providing invalid inputs.

Checklist

If the pull request includes user-facing changes, extra documentation is required:

  • If the change is user facing, please ensure you add info in one of the Changelog Inclusions sections.

Changelog Inclusions

Changes

--file input for the splicectl apply default-cr command is now partially validated before being sent to the splicectl/api.

Checklist

@RileyMcCuen RileyMcCuen merged commit f3fa561 into main Jun 10, 2021
@RileyMcCuen RileyMcCuen deleted the DBAAS-5601 branch June 10, 2021 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants