Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

Validate and set default values of template parameters - #61

Merged
jhernand merged 2 commits into
osac-project:mainfrom
jhernand:validate_and_set_default_values_of_template_parameters
Jul 17, 2025
Merged

jhernand merged 2 commits into
osac-project:mainfrom
jhernand:validate_and_set_default_values_of_template_parameters

Conversation

@jhernand

@jhernand jhernand commented Jul 4, 2025

Copy link
Copy Markdown
Contributor

This patch changes the clusters server so that it validates that the template parameters specified in the cluster are valid, and sets the default values for those that aren't specified.

@jhernand
jhernand force-pushed the validate_and_set_default_values_of_template_parameters branch 2 times, most recently from 2979d34 to 4a3e510 Compare July 11, 2025 10:54
This patch changes the clusters server so that it validates that the
template parameters specified in the cluster are valid, and sets the
default values for those that aren't specified.

Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
@jhernand
jhernand force-pushed the validate_and_set_default_values_of_template_parameters branch from 4a3e510 to c5b72ab Compare July 16, 2025 10:05
@jhernand
jhernand requested review from adriengentil and larsks July 16, 2025 10:05
Comment thread internal/servers/clusters_server.go Outdated
err = grpcstatus.Errorf(
grpccodes.InvalidArgument,
"template parameter '%s' doesn't exist, valid values for template '%s' are %s",
clusterParameterName, templateId, english.WordSeries(templateParameterNames, "and"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to group together all invalid template parameters and then send a single error that says something like "template parameters X, Y, Z don't exist, valid values..."?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that makes sense, will do it.

@jhernand jhernand Jul 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@tzumainn I added a commit to the pull request to change the validation as you suggested: 116c64a

This patch changes the clusters server so that it returns a single error
message with the names of all the template parameters that don't
exist. For example, if the user tries to use parameters `junk1` and
`junk2` that don't exist in the template the error message returned will
be like this:

```
template parameters 'junk1' and 'junk2' don't exist, valid values for
template 'my_template' are 'my_param' and 'your_param'",
```

Signed-off-by: Juan Hernandez <juan.hernandez@redhat.com>
@jhernand
jhernand force-pushed the validate_and_set_default_values_of_template_parameters branch from f02ae3a to 116c64a Compare July 16, 2025 16:26
@jhernand
jhernand merged commit 36e9d36 into osac-project:main Jul 17, 2025
@jhernand
jhernand deleted the validate_and_set_default_values_of_template_parameters branch July 17, 2025 16:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants