diff options
| author | Jeff Carr <[email protected]> | 2024-10-26 01:02:09 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-26 01:02:09 -0500 |
| commit | 7320fceb8d8cf6ed32dd139fb91667ed3b84c4f2 (patch) | |
| tree | 04c00324dbe201a312bab12592e8a9101bc38d55 /validate.go | |
| parent | 61b954ecca1ab059167311b527e3102b3f9acd40 (diff) | |
finds disks and puts dirs in the protobuf cluster
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'validate.go')
| -rw-r--r-- | validate.go | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/validate.go b/validate.go index 4e0dabe..2668e9f 100644 --- a/validate.go +++ b/validate.go @@ -37,9 +37,11 @@ func checkUniqueMac(mac string) bool { return true } -func addClusterFilepath(dir string) { +// records all the known paths. this should go in the protobuf +func addClusterFilepath(dir string) *pb.Event { var found bool = false - for _, d := range me.dirs { + var e *pb.Event + for _, d := range me.cluster.Dirs { if d == dir { // found dir found = true @@ -47,8 +49,13 @@ func addClusterFilepath(dir string) { } } if !found { - me.dirs = append(me.dirs, dir) + if dir != "." { + // make a new Add Event + e = NewAddEvent(nil, "Add Cluster Directory", dir) + me.cluster.Dirs = append(me.cluster.Dirs, dir) + } } + return e } // returns the droplet using a filename @@ -106,6 +113,7 @@ func checkUniqueFilenames() bool { for _, d := range me.cluster.Droplets { for _, disk := range d.Disks { filename := disk.Filename + addClusterFilepath(disk.Filepath) if _, ok := disks[filename]; ok { /* if argv.IgnDisk { @@ -135,6 +143,7 @@ func checkDiskFilenames() []*pb.Event { filename := disk.Filename filebase := filepath.Base(filename) dir := filepath.Dir(filename) + addClusterFilepath(dir) if disk.Filename != filebase { // update filename e := NewChangeEvent(d, "Disk.Filename", disk.Filename, filebase) |
