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

make the template processing more compatible with the dynamic client #20337

Merged
merged 1 commit into from
Jul 18, 2018

Conversation

deads2k
Copy link
Contributor

@deads2k deads2k commented Jul 17, 2018

Simplify processing a template via the API and getting a result you can use with dynamic client.

post-rebase request from @mfojtik

/assign @mfojtik

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 17, 2018
@deads2k deads2k mentioned this pull request Jul 17, 2018
17 tasks

func (c *dynamicTemplateProcessor) ProcessToListFromUnstructured(unstructuredTemplate *unstructured.Unstructured) (*unstructured.UnstructuredList, error) {
processedTemplate, err := c.client.Resource(templatev1.GroupVersion.WithResource("processedtemplates")).
Namespace("default").Create(unstructuredTemplate)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you check the error here?

if err != nil {
return nil, err
}
return processedList, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

i would just return processedTemplate.ToList()

}
processedList, err := processedTemplate.ToList()
templateProcessor := templateprocessing.NewDynamicTemplateProcessor(r.client)
processedList, err := templateProcessor.ProcessToList(template)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: templateprocessing.NewDynamicTemplateProcessor(r.client).ProcessToList(template) but I don't care much

@@ -453,3 +434,13 @@ func TestProcessTemplateParameters(t *testing.T) {
t.Errorf("unexpected output: %s", diff.StringDiff(string(exp), string(result)))
}
}

// AddParameter adds new custom parameter to the Template. It overrides
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: lower case

@mfojtik
Copy link
Contributor

mfojtik commented Jul 17, 2018

@deads2k small nits, LGTM otherwise

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: deads2k

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deads2k deads2k added the lgtm Indicates that a PR is ready to be merged. label Jul 18, 2018
@deads2k
Copy link
Contributor Author

deads2k commented Jul 18, 2018

comments addressed.

@deads2k
Copy link
Contributor Author

deads2k commented Jul 18, 2018

/retest

@openshift-merge-robot openshift-merge-robot merged commit af0a9b4 into openshift:master Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants