diff --git a/commands/displayers/droplet_backup_policies.go b/commands/displayers/droplet_backup_policies.go index 90b6589c0..366f77add 100644 --- a/commands/displayers/droplet_backup_policies.go +++ b/commands/displayers/droplet_backup_policies.go @@ -37,13 +37,16 @@ func (d *DropletBackupPolicy) ColMap() map[string]string { func (d *DropletBackupPolicy) KV() []map[string]any { out := make([]map[string]any, 0) for _, policy := range d.DropletBackupPolicies { - m := map[string]any{ - "DropletID": policy.DropletID, "BackupEnabled": policy.BackupEnabled, "BackupPolicyPlan": policy.BackupPolicy.Plan, - "BackupPolicyWeekday": policy.BackupPolicy.Weekday, "BackupPolicyHour": policy.BackupPolicy.Hour, - "BackupPolicyWindowLengthHours": policy.BackupPolicy.WindowLengthHours, "BackupPolicyRetentionPeriodDays": policy.BackupPolicy.RetentionPeriodDays, - "NextBackupWindowStart": policy.NextBackupWindow.Start, "NextBackupWindowEnd": policy.NextBackupWindow.End, + if policy.BackupPolicy != nil && policy.NextBackupWindow != nil { + m := map[string]any{ + "DropletID": policy.DropletID, "BackupEnabled": policy.BackupEnabled, + "BackupPolicyPlan": policy.BackupPolicy.Plan, + "BackupPolicyWeekday": policy.BackupPolicy.Weekday, "BackupPolicyHour": policy.BackupPolicy.Hour, + "BackupPolicyWindowLengthHours": policy.BackupPolicy.WindowLengthHours, "BackupPolicyRetentionPeriodDays": policy.BackupPolicy.RetentionPeriodDays, + "NextBackupWindowStart": policy.NextBackupWindow.Start, "NextBackupWindowEnd": policy.NextBackupWindow.End, + } + out = append(out, m) } - out = append(out, m) } return out diff --git a/do/droplets.go b/do/droplets.go index a162cf4e6..999364a48 100644 --- a/do/droplets.go +++ b/do/droplets.go @@ -15,7 +15,6 @@ package do import ( "context" - "fmt" "github.com/digitalocean/godo" "github.com/digitalocean/godo/util" @@ -391,7 +390,6 @@ func (ds *dropletsService) ListBackupPolicies() (DropletBackupPolicies, error) { } list := make(DropletBackupPolicies, len(si)) - fmt.Println("si: ", si) for i := range si { p := si[i].(*godo.DropletBackupPolicy) list[i] = DropletBackupPolicy{DropletBackupPolicy: p}