summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-25 19:16:44 -0500
committerJeff Carr <[email protected]>2024-10-25 19:16:44 -0500
commit030af1bcfb7dad880a9fdf4286432fc36d1bf251 (patch)
treeae093e875206c32d771c0a52f651ee57380b46da /main.go
parenta5eee861ea52fb0a33827fed3770f383aaeca03a (diff)
check for duplicate disk names
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go38
1 files changed, 23 insertions, 15 deletions
diff --git a/main.go b/main.go
index a93af29..ae4babe 100644
--- a/main.go
+++ b/main.go
@@ -53,10 +53,17 @@ func main() {
os.Exit(-1)
}
+ var newEvents []*pb.Event
+
// sanity check the droplets
checkDroplets(false)
+ newe := checkDiskFilenames()
+ for _, e := range newe {
+ newEvents = append(newEvents, e)
+ }
+ checkUniqueFilenames()
+
- var newEvents []*pb.Event
for _, filename := range argv.Xml {
domcfg, err := readXml(filename)
if err != nil {
@@ -81,21 +88,22 @@ func main() {
newEvents = append(newEvents, e)
}
}
- if len(argv.Xml) != 0 {
- for i, e := range newEvents {
- log.Info(i, "Event:", e.Droplet, e.FieldName, "orig:", e.OrigVal, "new:", e.NewVal)
- }
- if me.changed {
- if argv.Save {
- writeConfigFile()
- writeConfigFileDroplets()
- log.Info("XML changes saved in protobuf config")
- os.Exit(0)
- } else {
- log.Info("Not saving changes (use --save to save)")
- os.Exit(0)
- }
+ for i, e := range newEvents {
+ log.Info(i, "Event:", e.Droplet, e.FieldName, "orig:", e.OrigVal, "new:", e.NewVal)
+ me.changed = true
+ }
+ if me.changed {
+ if argv.Save {
+ writeConfigFile()
+ writeConfigFileDroplets()
+ log.Info("XML changes saved in protobuf config")
+ os.Exit(0)
+ } else {
+ log.Info("Not saving changes (use --save to save)")
+ os.Exit(0)
}
+ }
+ if len(argv.Xml) != 0 {
log.Info("No XML changes found")
os.Exit(0)
}