Skip to content

Commit

Permalink
feat: cancel to check len of content equal to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
vie-serendipity committed Oct 18, 2024
1 parent 2c6380e commit 5163848
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/yurthub/storage/disk/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,9 @@ func (ds *diskStorage) ReplaceComponentList(component string, gvr schema.GroupVe
// 2. create new file with contents
// TODO: if error happens, we may need retry mechanism, or add some mechanism to do consistency check.
// create abspath dir in case that contents is empty
if len(contents) == 0 {
if err := ds.fsOperator.CreateDir(absPath); err != nil {
klog.Errorf("could not create dir at %s, %v", absPath, err)
return err
}
if err := ds.fsOperator.CreateDir(absPath); err != nil {
klog.Errorf("could not create dir at %s, %v", absPath, err)
return err

Check warning on line 389 in pkg/yurthub/storage/disk/storage.go

View check run for this annotation

Codecov / codecov/patch

pkg/yurthub/storage/disk/storage.go#L388-L389

Added lines #L388 - L389 were not covered by tests
}
for key, data := range contents {
path := filepath.Join(ds.baseDir, key.Key())
Expand Down

0 comments on commit 5163848

Please sign in to comment.