@@ -101,8 +101,11 @@ func NetworkRunner(userOptions *opts.NetworkUserOptions) rosa.CommandRunner {
101
101
parsedParams ["Region" ] = r .AWSClient .GetRegion ()
102
102
}
103
103
104
- extractTemplateCommand (r , argv , options .args ,
104
+ err = extractTemplateCommand (r , argv , options .args ,
105
105
& templateCommand , & templateFile )
106
+ if err != nil {
107
+ return err
108
+ }
106
109
107
110
service := helper .NewNetworkService ()
108
111
@@ -136,7 +139,7 @@ func NetworkRunner(userOptions *opts.NetworkUserOptions) rosa.CommandRunner {
136
139
}
137
140
138
141
func extractTemplateCommand (r * rosa.Runtime , argv []string , options * opts.NetworkUserOptions ,
139
- templateCommand * string , templateFile * string ) {
142
+ templateCommand * string , templateFile * string ) error {
140
143
if len (argv ) == 0 {
141
144
r .Reporter .Infof ("No template name provided in the command. " +
142
145
"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
157
160
} else {
158
161
templateDir := options .TemplateDir
159
162
* 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 )
160
168
}
169
+ return nil
161
170
}
0 commit comments