Skip to content

Commit fde87a8

Browse files
committed
OCM-13406 | ci: fix one function issue leading the destroy and post-destroy cases failure
1 parent 8052e87 commit fde87a8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

tests/utils/handler/cluster_handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,13 @@ func (ch *clusterHandler) GenerateClusterCreateFlags() ([]string, error) {
394394
if ch.profile.ClusterConfig.SharedVPC && ch.profile.ClusterConfig.HCP {
395395
sharedVPCAdditionalPrincipalsForHostedCP = fmt.Sprintf("%s,%s", sharedRoute53RoleArn, sharedVPCEndPointRoleArn)
396396
}
397-
if sharedVPCAdditionalPrincipalsForHostedCP != "" {
397+
if sharedVPCAdditionalPrincipalsForHostedCP != "" && additionalPrincipalRoleArn != "" {
398398
flags = append(flags, "--additional-allowed-principals",
399399
fmt.Sprintf("%s,%s", sharedVPCAdditionalPrincipalsForHostedCP, additionalPrincipalRoleArn))
400-
} else if additionalPrincipalRoleArn != "" {
400+
} else if sharedVPCAdditionalPrincipalsForHostedCP == "" && additionalPrincipalRoleArn != "" {
401401
flags = append(flags, "--additional-allowed-principals", additionalPrincipalRoleArn)
402+
} else if sharedVPCAdditionalPrincipalsForHostedCP != "" && additionalPrincipalRoleArn == "" {
403+
flags = append(flags, "--additional-allowed-principals", sharedVPCAdditionalPrincipalsForHostedCP)
402404
}
403405

404406
}

tests/utils/handler/resources_handler.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func newResourcesHandler(client *rosacli.Client, region string, persist bool,
122122
awsCredentialsFile: awsCredentialsFile,
123123
awsSharedAccountCredentialsFile: awsSharedAccountCredentialsFile,
124124
}
125+
125126
if loadFilesystem {
126127
err := helper.ReadFileContentToObject(config.Test.UserDataFile, &resourcesHandler.resources)
127128
if err != nil {
@@ -295,6 +296,7 @@ func (rh *resourcesHandler) DestroyResources() (errors []error) {
295296
func (rh *resourcesHandler) saveToFile() (err error) {
296297
if !rh.persist {
297298
log.Logger.Debug("Ignoring save to file as per configuration")
299+
return
298300
}
299301
_, err = helper.CreateFileWithContent(config.Test.UserDataFile, &rh.resources)
300302
if err != nil {

0 commit comments

Comments
 (0)