Skip to content

Commit 69b6883

Browse files
committed
fix linting
Signed-off-by: Will Arroyo <warroyo7199008@gmail.com>
1 parent 4e3a2bb commit 69b6883

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

internal/resources/kubernetessecret/data_source_secret.go

+2
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,13 @@ func dataSourceSecretRead(ctx context.Context, d *schema.ResourceData, m interfa
7979
d.SetId(secretDataFromServer.UID)
8080

8181
var password string
82+
8283
var opaqueData map[string]interface{}
8384

8485
if _, ok := d.GetOk(helper.GetFirstElementOf(spec.SpecKey, spec.DockerConfigjsonKey, spec.PasswordKey)); ok {
8586
password, _ = (d.Get(helper.GetFirstElementOf(spec.SpecKey, spec.DockerConfigjsonKey, spec.PasswordKey))).(string)
8687
}
88+
8789
if opData, ok := d.GetOk(helper.GetFirstElementOf(spec.SpecKey, spec.OpaqueKey)); ok && opData != nil {
8890
opaqueData = opData.(map[string]interface{})
8991
}

internal/resources/kubernetessecret/resource_secret.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ func resourceSecretInPlaceUpdate(ctx context.Context, d *schema.ResourceData, m
280280
return diag.Errorf("updating %v is not possible", spec.ImageRegistryURLKey)
281281
}
282282

283-
if updateCheckForMeta(d, secretDataFromServer.meta) || updateCheckForSpec(ctx, d, secretDataFromServer.atomicSpec, scopedFullnameData.Scope) {
284-
283+
if updateCheckForMeta(d, secretDataFromServer.meta) || updateCheckForSpec(d, secretDataFromServer.atomicSpec, scopedFullnameData.Scope) {
285284
switch scopedFullnameData.Scope {
286285
case commonscope.ClusterScope:
287286
if scopedFullnameData.FullnameCluster != nil {
@@ -330,8 +329,7 @@ func resourceSecretInPlaceUpdate(ctx context.Context, d *schema.ResourceData, m
330329
return dataSourceSecretRead(ctx, d, m)
331330
}
332331

333-
func updateCheckForSpec(ctx context.Context, d *schema.ResourceData, atomicSpec *clustersecretmodel.VmwareTanzuManageV1alpha1ClusterNamespaceSecretSpec, scope commonscope.Scope) bool {
334-
332+
func updateCheckForSpec(d *schema.ResourceData, atomicSpec *clustersecretmodel.VmwareTanzuManageV1alpha1ClusterNamespaceSecretSpec, scope commonscope.Scope) bool {
335333
if !(spec.HasSpecChanged(d)) {
336334
username := d.Get(helper.GetFirstElementOf(spec.SpecKey, spec.DockerConfigjsonKey, spec.UsernameKey))
337335
password := d.Get(helper.GetFirstElementOf(spec.SpecKey, spec.DockerConfigjsonKey, spec.PasswordKey))

internal/resources/kubernetessecret/spec/cluster_scope.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func ConstructSpecForClusterScope(d *schema.ResourceData) (spec *secretmodel.Vmw
3333

3434
specData := data[0].(map[string]interface{})
3535
if v, ok := specData[DockerConfigjsonKey]; ok {
36-
3736
if v1, ok := v.([]interface{}); ok && len(v1) != 0 {
3837
spec.SecretType = secretmodel.NewVmwareTanzuManageV1alpha1ClusterNamespaceSecretType(secretmodel.VmwareTanzuManageV1alpha1ClusterNamespaceSecretTypeSECRETTYPEDOCKERCONFIGJSON)
3938

@@ -65,15 +64,13 @@ func ConstructSpecForClusterScope(d *schema.ResourceData) (spec *secretmodel.Vmw
6564
}
6665

6766
if v, ok := specData[OpaqueKey]; ok {
68-
6967
opaqueData := common.GetTypeStringMapData(v.(map[string]interface{}))
7068
if len(opaqueData) != 0 {
7169
spec.SecretType = secretmodel.NewVmwareTanzuManageV1alpha1ClusterNamespaceSecretType(secretmodel.VmwareTanzuManageV1alpha1ClusterNamespaceSecretTypeSECRETTYPEOPAQUE)
7270

7371
encodedData := getEncodedOpaqueData(opaqueData)
7472
spec.Data = encodedData
7573
}
76-
7774
}
7875

7976
return spec
@@ -83,6 +80,7 @@ func FlattenSpecForClusterScope(spec *secretmodel.VmwareTanzuManageV1alpha1Clust
8380
if spec == nil {
8481
return data
8582
}
83+
8684
flattenSpecData := make(map[string]interface{})
8785

8886
if *spec.SecretType == *secretmodel.NewVmwareTanzuManageV1alpha1ClusterNamespaceSecretType(secretmodel.VmwareTanzuManageV1alpha1ClusterNamespaceSecretTypeSECRETTYPEDOCKERCONFIGJSON) {
@@ -119,7 +117,6 @@ func FlattenSpecForClusterScope(spec *secretmodel.VmwareTanzuManageV1alpha1Clust
119117
}
120118

121119
if *spec.SecretType == *secretmodel.NewVmwareTanzuManageV1alpha1ClusterNamespaceSecretType(secretmodel.VmwareTanzuManageV1alpha1ClusterNamespaceSecretTypeSECRETTYPEOPAQUE) {
122-
123120
flattenSpecData[OpaqueKey] = opaqueData
124121
}
125122

internal/resources/kubernetessecret/spec/spec.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,21 @@ func ValidateInput(ctx context.Context, diff *schema.ResourceDiff, i interface{}
129129
secretTypesFound = append(secretTypesFound, secret)
130130
}
131131
}
132+
132133
if secret == DockerConfigjsonKey {
133134
converted := secretData.([]interface{})
134135
if len(converted) != 0 {
135136
secretTypesFound = append(secretTypesFound, secret)
136137
}
137138
}
138-
139139
}
140140
}
141141

142142
if len(secretTypesFound) == 0 {
143-
return fmt.Errorf("no valid spec block found: minimum one valid secret block is required among: %v", strings.Join(secretTypes[:], `, `))
143+
return fmt.Errorf("no valid spec block found: minimum one valid secret block is required among: %v", strings.Join(secretTypes, `, `))
144144
} else if len(secretTypesFound) > 1 {
145145
return fmt.Errorf("found secret blocks: %v are not valid: maximum one valid secret block is allowed", strings.Join(secretTypesFound, `, `))
146146
}
147+
147148
return nil
148149
}

0 commit comments

Comments
 (0)