Skip to content

Commit

Permalink
do not regen ceos system mac file
Browse files Browse the repository at this point in the history
  • Loading branch information
hellt committed Nov 22, 2021
1 parent 81363ee commit da483dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nodes/ceos/ceos.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,14 @@ func createCEOSFiles(node *types.NodeConfig) error {
return err
}
m[5] = m[5] + 1
utils.CreateFile(path.Join(node.LabDir, "flash", "system_mac_address"), m.String())
return nil

sysMacPath := path.Join(node.LabDir, "flash", "system_mac_address")

if !utils.FileExists(sysMacPath) {
err = utils.CreateFile(sysMacPath, m.String())
}

return err
}

// ceosPostDeploy runs postdeploy actions which are required for ceos nodes
Expand Down
1 change: 1 addition & 0 deletions utils/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var errNonRegularFile = errors.New("non-regular file")
var errFileNotExist = errors.New("file does not exist")
var errHTTPFetch = errors.New("failed to fetch http(s) resource")

// FileExists returns true if a file referenced by filename exists
func FileExists(filename string) bool {
f, err := os.Stat(filename)
if os.IsNotExist(err) {
Expand Down

0 comments on commit da483dc

Please sign in to comment.