Skip to content

Commit

Permalink
Fix bugs about karmada-data dir lost
Browse files Browse the repository at this point in the history
Signed-off-by: jwcesign <jiangwei115@huawei.com>
  • Loading branch information
jwcesign committed Sep 21, 2022
1 parent d81f0ff commit a6b6697
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/karmadactl/cmdinit/kubernetes/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,16 @@ func (i *CommandInitOption) Complete() error {
}
}

// Determine whether KarmadaDataPath exists, if so, delete it
// Initialize karmada-data directory.
// If the directory already exists, just clean it up.
if utils.IsExist(i.KarmadaDataPath) {
if err := os.RemoveAll(i.KarmadaDataPath); err != nil {
return err
}
}
if err := os.MkdirAll(i.KarmadaDataPath, os.FileMode(0755)); err != nil {
return fmt.Errorf("failed to create directory: %s, error: %v", i.KarmadaDataPath, err)
}

return nil
}
Expand Down

0 comments on commit a6b6697

Please sign in to comment.