refactor: use type-specific functions for writing contents to a file
This commit is contained in:
@@ -755,10 +755,10 @@ func installHelperCommands(ctx context.Context) error {
|
||||
return fmt.Errorf("Unable to close %s file: %w", binaryName, err)
|
||||
}
|
||||
|
||||
err = common.WriteSliceToFile(common.WriteSliceToFileInput{
|
||||
err = common.WriteStringToFile(common.WriteStringToFileInput{
|
||||
Content: resp.String(),
|
||||
Filename: f.Name(),
|
||||
GroupName: "root",
|
||||
Lines: strings.Split(resp.String(), "\n"),
|
||||
Mode: os.FileMode(0755),
|
||||
Username: "root",
|
||||
})
|
||||
|
||||
@@ -107,9 +107,9 @@ func CommandInitialize(serverIP string, taintScheduling bool) error {
|
||||
return fmt.Errorf("Unable to close k3s installer file: %w", err)
|
||||
}
|
||||
|
||||
err = common.WriteSliceToFile(common.WriteSliceToFileInput{
|
||||
err = common.WriteStringToFile(common.WriteStringToFileInput{
|
||||
Content: resp.String(),
|
||||
Filename: f.Name(),
|
||||
Lines: strings.Split(resp.String(), "\n"),
|
||||
Mode: os.FileMode(0755),
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user