@@ -642,31 +642,30 @@ public void addEnvVars(List<TemplateEnvVar> envVars) {
642
642
* Deletes the template.
643
643
*/
644
644
@ POST
645
- public HttpResponse doDoDelete (@ AncestorInPath KubernetesCloud kubernetesCloud ) throws IOException {
645
+ public HttpResponse doDoDelete (@ AncestorInPath PodTemplateGroup owner ) throws IOException {
646
646
Jenkins j = Jenkins .get ();
647
647
j .checkPermission (Jenkins .ADMINISTER );
648
- if (kubernetesCloud == null ) {
648
+ if (owner == null ) {
649
649
throw new IllegalStateException ("Cloud could not be found" );
650
650
}
651
- kubernetesCloud .removeTemplate (this );
651
+ owner .removeTemplate (this );
652
652
j .save ();
653
653
// take the user back.
654
- return new HttpRedirect ("../../templates" );
654
+ return new HttpRedirect (owner . getPodTemplateGroupUrl () );
655
655
}
656
656
657
657
@ POST
658
- public HttpResponse doConfigSubmit (StaplerRequest req , @ AncestorInPath KubernetesCloud kubernetesCloud ) throws IOException , ServletException , Descriptor .FormException {
658
+ public HttpResponse doConfigSubmit (StaplerRequest req , @ AncestorInPath PodTemplateGroup owner ) throws IOException , ServletException , Descriptor .FormException {
659
659
Jenkins j = Jenkins .get ();
660
660
j .checkPermission (Jenkins .ADMINISTER );
661
- if (kubernetesCloud == null ) {
661
+ if (owner == null ) {
662
662
throw new IllegalStateException ("Cloud could not be found" );
663
663
}
664
- kubernetesCloud .removeTemplate (this );
665
664
PodTemplate newTemplate = reconfigure (req , req .getSubmittedForm ());
666
- kubernetesCloud . addTemplate ( newTemplate );
665
+ owner . replaceTemplate ( this , newTemplate );
667
666
j .save ();
668
667
// take the user back.
669
- return FormApply .success ("../../templates" );
668
+ return FormApply .success (owner . getPodTemplateGroupUrl () );
670
669
}
671
670
672
671
private PodTemplate reconfigure (@ NonNull final StaplerRequest req , JSONObject form ) throws Descriptor .FormException {
0 commit comments