create works from a filename

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-11-16 05:22:41 -06:00
parent 6944de6d85
commit f45dacfcaf
3 changed files with 8 additions and 5 deletions

View File

@ -25,14 +25,17 @@ func createFilename(dir string, filename string) error {
hostname := strings.TrimSuffix(filename, filetype) hostname := strings.TrimSuffix(filename, filetype)
log.Info("hostname ==", hostname) log.Info("hostname ==", hostname)
var newDroplet *pb.Droplet newDroplet := pb.NewDefaultDroplet(hostname)
newDroplet = new(pb.Droplet)
newDroplet.Hostname = hostname
newDisk := new(pb.Disk) newDisk := new(pb.Disk)
newDisk.Filename = filename newDisk.Filename = filename
newDisk.Filepath = dir newDisk.Filepath = dir
newDroplet.Disks = append(newDroplet.Disks, newDisk) newDroplet.Disks = append(newDroplet.Disks, newDisk)
var eth *pb.Network
eth = new(pb.Network)
eth.Name = "worldbr"
newDroplet.Networks = append(newDroplet.Networks, eth)
url := urlbase + "/create" url := urlbase + "/create"
// body, err := postDropletJSON(url, newDroplet) // body, err := postDropletJSON(url, newDroplet)