Skip to content

Commit

Permalink
Merge branch 'stable-1.1' into 271-docs-storage_flexcache_resource-ex…
Browse files Browse the repository at this point in the history
…ample-not-showing-up-correctly-1
  • Loading branch information
carchi8py committed Aug 19, 2024
2 parents 77cdd2c + 10df77e commit a4a29b3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@

## 1.1.4

DOC FIXES:
* **netapp-ontap_storage_flexcache_resource**: Fixed Page display issue ([[#271](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/271)])

BUG FIXES:
* **netapp-ontap_cluster_data_source: fix on nodes to show multiple elements ([#264](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/264))

## 1.1.3 (2024-08-08)

BUG FIXES:
Expand Down
4 changes: 2 additions & 2 deletions internal/interfaces/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ func GetClusterNodes(errorHandler *utils.ErrorHandler, r restclient.RestClient)
}
tflog.Debug(errorHandler.Ctx, fmt.Sprintf("Read cluster data source NODES - records: %#v", records))

var dataONTAP ClusterNodeGetDataModelONTAP
nodes := []ClusterNodeGetDataModelONTAP{}
var nodes []ClusterNodeGetDataModelONTAP
for _, record := range records {
var dataONTAP ClusterNodeGetDataModelONTAP
if err := mapstructure.Decode(record, &dataONTAP); err != nil {
return nil, errorHandler.MakeAndReportError("error decoding cluster nodes info", fmt.Sprintf("error: %s, statusCode %d, record %#v", err, statusCode, record))
}
Expand Down
2 changes: 1 addition & 1 deletion internal/interfaces/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func TestGetClusterNodes(t *testing.T) {
want []ClusterNodeGetDataModelONTAP
wantErr bool
}{
{name: "test_no_records_1", responses: responses["test_no_records_1"], want: []ClusterNodeGetDataModelONTAP{}, wantErr: false},
{name: "test_no_records_1", responses: responses["test_no_records_1"], want: nil, wantErr: false},
{name: "test_one_record_1", responses: responses["test_one_record_1"], want: expectedOneRecord, wantErr: false},
{name: "test_two_records_1", responses: responses["test_two_records_1"], want: expectedTwoRecords, wantErr: false},
{name: "test_error_1", responses: responses["test_error_1"], want: nil, wantErr: true},
Expand Down
16 changes: 9 additions & 7 deletions internal/provider/cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,15 @@ func (d *ClusterDataSource) Read(ctx context.Context, req datasource.ReadRequest
return
}

data.Nodes = make([]NodeDataSourceModel, 1)
ipAddressesIn := make([]string, 1)
ipAddressesIn[0] = nodes[0].ManagementInterfaces[0].IP.Address
ipAddressesOut, _ := types.ListValueFrom(ctx, types.StringType, ipAddressesIn)
data.Nodes[0] = NodeDataSourceModel{
Name: types.StringValue(nodes[0].Name),
MgmtIPAddresses: ipAddressesOut,
data.Nodes = make([]NodeDataSourceModel, len(nodes))
for i, v := range nodes {
ipAddressesIn := make([]string, 1)
ipAddressesIn[0] = v.ManagementInterfaces[0].IP.Address
ipAddressesOut, _ := types.ListValueFrom(ctx, types.StringType, ipAddressesIn)
data.Nodes[i] = NodeDataSourceModel{
Name: types.StringValue(v.Name),
MgmtIPAddresses: ipAddressesOut,
}
}

// Write logs using the tflog package
Expand Down

0 comments on commit a4a29b3

Please sign in to comment.