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)

View File

@ -77,7 +77,7 @@ func main() {
} }
log.Info("\n\nshould import here", argv.Start, "\n") log.Info("\n\nshould import here", argv.Start, "\n")
log.Info("import", argv.Import.Host, argv.Import.DomainName) log.Info("import", argv.Import.Host, argv.Import.DomainName)
url := "/import?domainName=" + argv.Import.DomainName url := "/import?domainName=" + argv.Import.DomainName
if argv.Import.Force { if argv.Import.Force {
url += "&force=true" url += "&force=true"
} }

View File

@ -20,7 +20,7 @@ func (b *virtigoT) Enable() {
// this app's variables // this app's variables
type virtigoT struct { type virtigoT struct {
cluster *pb.Cluster // basic cluster settings cluster *pb.Cluster // basic cluster settings
hmap map[*pb.Hypervisor]*HyperT // map to the local struct hmap map[*pb.Hypervisor]*HyperT // map to the local struct
names []string names []string
hypers []*HyperT hypers []*HyperT