summaryrefslogtreecommitdiff
path: root/add.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-31 04:29:51 -0500
committerJeff Carr <[email protected]>2024-10-31 04:29:51 -0500
commit96f29d6f3b696347dea1c22a0f3bda834a136d32 (patch)
tree4bab7bbe2776b107d2779b8d19889e22a652071b /add.go
parentc2229b65ab041aa80ff7b99b982b2e3061ba0ed7 (diff)
move more into add.go
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'add.go')
-rw-r--r--add.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/add.go b/add.go
index de58295..96f3fcb 100644
--- a/add.go
+++ b/add.go
@@ -128,3 +128,28 @@ func (c *Cluster) BlankFields() {
func (epb *Events) AppendEvent(e *Event) {
epb.Events = append(epb.Events, e)
}
+
+// check the cluster and droplet to make sure it's ready to start
+func (c *Cluster) DropletReady(d *Droplet) (bool, string) {
+ if c == nil {
+ return false, "cluster == nil"
+ }
+ if d == nil {
+ return false, "droplet == nil"
+ }
+ if d.Current == nil {
+ return false, "droplet.Current == nil"
+ }
+ // can't start already started droplet
+ if d.Current.State == DropletState_ON {
+ return false, "EVENT start droplet is already ON"
+ }
+ if d.Current.State != DropletState_OFF {
+ return false, "EVENT start droplet is not OFF state = " + string(d.Current.State)
+ }
+ if d.Current.StartAttempts > 2 {
+ // reason := "EVENT start droplet has already been started " + d.starts + " times"
+ return false, fmt.Sprintln("EVENT start droplet has already been started ", d.Current.StartAttempts, " times")
+ }
+ return true, ""
+}