Skip to content

Commit

Permalink
Merge pull request #2625 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…2619-to-release_1.2.48

[release_1.2.48] OCM-12486 | fix: Fixed network custom templates runner
  • Loading branch information
openshift-merge-bot[bot] authored Nov 13, 2024
2 parents bffbe90 + 6590cb1 commit 20a2e96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/create/network/cloudformation.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package network
const CloudFormationTemplateFile = `
AWSTemplateFormatVersion: '2010-09-09'
Description: CloudFormation template to create a ROSA Quickstart default VPC.
This CloudFormation template may not work with rosa CLI versions later than 1.2.47.
This CloudFormation template may not work with rosa CLI versions later than v1.2.48.
Please ensure that you are using the compatible CLI version before deploying this template.
Parameters:
Expand Down
13 changes: 11 additions & 2 deletions cmd/create/network/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,11 @@ func NetworkRunner(userOptions *opts.NetworkUserOptions) rosa.CommandRunner {
parsedParams["Region"] = r.AWSClient.GetRegion()
}

extractTemplateCommand(r, argv, options.args,
err = extractTemplateCommand(r, argv, options.args,
&templateCommand, &templateFile)
if err != nil {
return err
}

service := helper.NewNetworkService()

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

func extractTemplateCommand(r *rosa.Runtime, argv []string, options *opts.NetworkUserOptions,
templateCommand *string, templateFile *string) {
templateCommand *string, templateFile *string) error {
if len(argv) == 0 {
r.Reporter.Infof("No template name provided in the command. "+
"Defaulting to %s. Please note that a corresponding directory with this name"+
Expand All @@ -157,5 +160,11 @@ func extractTemplateCommand(r *rosa.Runtime, argv []string, options *opts.Networ
} else {
templateDir := options.TemplateDir
*templateFile = helper.SelectTemplate(templateDir, *templateCommand)
templateBody, err := os.ReadFile(*templateFile)
if err != nil {
return fmt.Errorf("failed to read template file: %w", err)
}
*templateFile = string(templateBody)
}
return nil
}

0 comments on commit 20a2e96

Please sign in to comment.