Skip to content

Commit

Permalink
Reduce nesting.
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Apr 25, 2022
1 parent 1a3f137 commit 2198ccf
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions netdeploy/networkTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ func (t NetworkTemplate) createNodeDirectories(targetFolder string, binDir strin
nodeDir := filepath.Join(targetFolder, cfg.Name)
err = os.Mkdir(nodeDir, os.ModePerm)
if err != nil {
if os.IsExist(err) {
// allow some flexibility around pre-existing directories to support docker and pre-mounted volumes.
if !util.IsEmpty(nodeDir) {
err = fmt.Errorf("duplicate node directory detected: %w", err)
return
}
} else {
if !os.IsExist(err) {
return
}

// allow some flexibility around pre-existing directories to
// support docker and pre-mounted volumes.
if !util.IsEmpty(nodeDir) {
err = fmt.Errorf("duplicate node directory detected: %w", err)
return
}
}
Expand Down

0 comments on commit 2198ccf

Please sign in to comment.