summaryrefslogtreecommitdiff
path: root/addDroplet.go
diff options
context:
space:
mode:
Diffstat (limited to 'addDroplet.go')
-rw-r--r--addDroplet.go29
1 files changed, 14 insertions, 15 deletions
diff --git a/addDroplet.go b/addDroplet.go
index 305e45b..4a1f314 100644
--- a/addDroplet.go
+++ b/addDroplet.go
@@ -20,24 +20,23 @@ func addDomainDroplet(domcfg *libvirtxml.Domain) (*DropletT, error) {
}
d, _ := findDomain(domcfg)
- if d != nil {
- return d, errors.New(d.pb.Hostname + " droplet exists. need to update instead")
- }
- // this is a new unknown droplet (not in the config file)
- d = new(DropletT)
+ if d == nil {
+ // this is a new unknown droplet (not in the config file)
+ d = new(DropletT)
- d.pb = me.cluster.AddDroplet(domcfg.UUID, domcfg.Name, 2, 2*1024*1024)
- d.pb.StartState = pb.DropletState_OFF
- d.CurrentState = pb.DropletState_UNKNOWN
+ d.pb = me.cluster.AddDroplet(domcfg.UUID, domcfg.Name, 2, 2*1024*1024)
+ d.pb.StartState = pb.DropletState_OFF
+ d.CurrentState = pb.DropletState_UNKNOWN
- // if the domcfg doesn't have a uuid, make a new one here
- if d.pb.Uuid == "" {
- u := uuid.New()
- d.pb.Uuid = u.String()
- }
+ // if the domcfg doesn't have a uuid, make a new one here
+ if d.pb.Uuid == "" {
+ u := uuid.New()
+ d.pb.Uuid = u.String()
+ }
- me.droplets = append(me.droplets, d)
- me.changed = true
+ me.droplets = append(me.droplets, d)
+ me.changed = true
+ }
err := updateDroplet(d, domcfg)
if err != nil {