summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-11-01 12:49:51 -0500
committerJeff Carr <[email protected]>2024-11-01 12:49:51 -0500
commit17f8c31027d5f726cb961bac1d3217336b0c3d00 (patch)
treea8b6daaa484f1869c124348f5a06f2c688116ec3
parentd8c3744f20cd2da3b259390c68fa7e651d63b617 (diff)
things are working againv0.2.1
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--config.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/config.go b/config.go
index d583695..7be4a67 100644
--- a/config.go
+++ b/config.go
@@ -44,6 +44,7 @@ func (c *NewCluster) ConfigSave() error {
fmt.Println("droplets.json write failed")
return err
}
+ c.configWriteDroplets()
if err := ConfigWriteJSON(c.H, "hypervisors.json"); err != nil {
fmt.Println("hypervisors.json write failed")
@@ -174,3 +175,23 @@ func ConfigWriteTEXT(a any, filename string) error {
fmt.Fprintln(cfgfile, text)
return nil
}
+
+func (c *NewCluster) configWriteDroplets() error {
+ fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), "droplets.new.text")
+ cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, 0666)
+ defer cfgfile.Close()
+ if err != nil {
+ fmt.Println("open config file :", err)
+ return err
+ }
+ loop := c.DropletsAll() // get the list of droplets
+ for loop.Scan() {
+ d := loop.Droplet()
+ var newd Droplet
+ newd = *d
+ newd.Current = nil
+ text := prototext.Format(&newd)
+ fmt.Fprintln(cfgfile, text)
+ }
+ return nil
+}