things are working again
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d8c3744f20
commit
17f8c31027
21
config.go
21
config.go
|
@ -44,6 +44,7 @@ func (c *NewCluster) ConfigSave() error {
|
||||||
fmt.Println("droplets.json write failed")
|
fmt.Println("droplets.json write failed")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
c.configWriteDroplets()
|
||||||
|
|
||||||
if err := ConfigWriteJSON(c.H, "hypervisors.json"); err != nil {
|
if err := ConfigWriteJSON(c.H, "hypervisors.json"); err != nil {
|
||||||
fmt.Println("hypervisors.json write failed")
|
fmt.Println("hypervisors.json write failed")
|
||||||
|
@ -174,3 +175,23 @@ func ConfigWriteTEXT(a any, filename string) error {
|
||||||
fmt.Fprintln(cfgfile, text)
|
fmt.Fprintln(cfgfile, text)
|
||||||
return nil
|
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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue