Skip to content

Commit 20a2e96

Browse files
Merge pull request #2625 from openshift-cherrypick-robot/cherry-pick-2619-to-release_1.2.48
[release_1.2.48] OCM-12486 | fix: Fixed network custom templates runner
2 parents bffbe90 + 6590cb1 commit 20a2e96

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

cmd/create/network/cloudformation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package network
55
const CloudFormationTemplateFile = `
66
AWSTemplateFormatVersion: '2010-09-09'
77
Description: CloudFormation template to create a ROSA Quickstart default VPC.
8-
This CloudFormation template may not work with rosa CLI versions later than 1.2.47.
8+
This CloudFormation template may not work with rosa CLI versions later than v1.2.48.
99
Please ensure that you are using the compatible CLI version before deploying this template.
1010
1111
Parameters:

cmd/create/network/cmd.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,11 @@ func NetworkRunner(userOptions *opts.NetworkUserOptions) rosa.CommandRunner {
101101
parsedParams["Region"] = r.AWSClient.GetRegion()
102102
}
103103

104-
extractTemplateCommand(r, argv, options.args,
104+
err = extractTemplateCommand(r, argv, options.args,
105105
&templateCommand, &templateFile)
106+
if err != nil {
107+
return err
108+
}
106109

107110
service := helper.NewNetworkService()
108111

@@ -136,7 +139,7 @@ func NetworkRunner(userOptions *opts.NetworkUserOptions) rosa.CommandRunner {
136139
}
137140

138141
func extractTemplateCommand(r *rosa.Runtime, argv []string, options *opts.NetworkUserOptions,
139-
templateCommand *string, templateFile *string) {
142+
templateCommand *string, templateFile *string) error {
140143
if len(argv) == 0 {
141144
r.Reporter.Infof("No template name provided in the command. "+
142145
"Defaulting to %s. Please note that a corresponding directory with this name"+
@@ -157,5 +160,11 @@ func extractTemplateCommand(r *rosa.Runtime, argv []string, options *opts.Networ
157160
} else {
158161
templateDir := options.TemplateDir
159162
*templateFile = helper.SelectTemplate(templateDir, *templateCommand)
163+
templateBody, err := os.ReadFile(*templateFile)
164+
if err != nil {
165+
return fmt.Errorf("failed to read template file: %w", err)
166+
}
167+
*templateFile = string(templateBody)
160168
}
169+
return nil
161170
}

0 commit comments

Comments
 (0)