Skip to content

Commit 4d05eb7

Browse files
authored
Merge branch 'master' into master
2 parents b83afa7 + 0e59d48 commit 4d05eb7

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
## 1.56.10 (Unreleased)
1+
## 1.56.11 (Unreleased)
2+
3+
## 1.56.10
4+
5+
BUG FIXES
6+
7+
* Resource `tencentcloud_tcr_namespace` fix create two namespace and one name is substring of another, then got an error about more than 1
8+
* Resource `tencentcloud_tcr_namespace` fix create two repositories and one name is substring of another, then got an error about more than 1
9+
10+
211
## 1.56.9 (Jun 09, 2021)
312

413
BUG FIXES:

tencentcloud/service_tencentcloud_tcr.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,15 @@ func (me *TCRService) DescribeTCRNameSpaceById(ctx context.Context, instanceId s
307307

308308
if len(namespaces) == 0 {
309309
return nil, has, nil
310-
} else if len(namespaces) > 1 {
311-
errRet = fmt.Errorf("TencentCloud SDK return more than 1 namespaces, %s %s", instanceId, name)
312-
return
313310
}
314311

315-
namespace = namespaces[0]
316-
has = true
312+
for i := range namespaces {
313+
if name == *namespaces[i].Name {
314+
namespace = namespaces[i]
315+
has = true
316+
return
317+
}
318+
}
317319
return
318320
}
319321

@@ -445,13 +447,16 @@ func (me *TCRService) DescribeTCRRepositoryById(ctx context.Context, instanceId
445447

446448
if len(repositories) == 0 {
447449
return nil, has, nil
448-
} else if len(repositories) > 1 {
449-
errRet = fmt.Errorf("TencentCloud SDK return more than 1 namespaces, %s %s %s", instanceId, namespace, repositoryName)
450-
return
451450
}
452451

453-
repository = repositories[0]
454-
has = true
452+
for i := range repositories {
453+
if *repositories[i].Name == namespace+"/"+repositoryName {
454+
repository = repositories[i]
455+
has = true
456+
return
457+
}
458+
}
459+
455460
return
456461
}
457462

0 commit comments

Comments
 (0)