Skip to content

Commit

Permalink
Merge pull request #35 from platform9/private/thenilesh/etcdbackup-pa…
Browse files Browse the repository at this point in the history
…nic-fix

bugfix: Add etcdBackupConfig nil check
  • Loading branch information
anmolsachan authored Jun 24, 2024
2 parents 7950ee6 + 62aab14 commit e06643d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions internal/provider/cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1642,7 +1642,9 @@ func getEtcdBackupConfig(ctx context.Context, etcdBackupValue resource_cluster.E
}
}
if !etcdBackupValue.StorageLocalPath.IsNull() && !etcdBackupValue.StorageLocalPath.IsUnknown() {
etcdBackupConfig.StorageProperties.LocalPath = etcdBackupValue.StorageLocalPath.ValueStringPointer()
etcdBackupConfig.StorageProperties = &qbert.StorageProperties{
LocalPath: etcdBackupValue.StorageLocalPath.ValueStringPointer(),
}
}
if etcdBackupValue.StorageType.ValueString() != "" {
etcdBackupConfig.StorageType = ptr.To(etcdBackupValue.StorageType.ValueString())
Expand Down Expand Up @@ -1672,7 +1674,7 @@ func getEtcdBackupValue(ctx context.Context, etcdBackupConfig *qbert.EtcdBackupC
if etcdBackupConfig.IntervalInHours != nil && *etcdBackupConfig.IntervalInHours != 0 || etcdBackupConfig.IntervalInMins != 0 {
var backupIntervalVal string
if *etcdBackupConfig.IntervalInHours != 0 {
backupIntervalVal = fmt.Sprintf("%dh", etcdBackupConfig.IntervalInHours)
backupIntervalVal = fmt.Sprintf("%dh", *etcdBackupConfig.IntervalInHours)
} else if etcdBackupConfig.IntervalInMins != 0 {
backupIntervalVal = fmt.Sprintf("%dm", etcdBackupConfig.IntervalInMins)
}
Expand All @@ -1693,7 +1695,7 @@ func getEtcdBackupValue(ctx context.Context, etcdBackupConfig *qbert.EtcdBackupC
intervalObjVal = types.ObjectNull(resource_cluster.IntervalValue{}.AttributeTypes(ctx))
}
var localPath string
if etcdBackupConfig.StorageProperties.LocalPath != nil {
if etcdBackupConfig.StorageProperties != nil && etcdBackupConfig.StorageProperties.LocalPath != nil {
localPath = *etcdBackupConfig.StorageProperties.LocalPath
}

Expand Down

0 comments on commit e06643d

Please sign in to comment.