Skip to content

Commit

Permalink
Handle internal PC Version names in v4 compatibility check
Browse files Browse the repository at this point in the history
  • Loading branch information
thunderboltsid committed Jul 25, 2024
1 parent 8516a15 commit 103cda4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions controllers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,8 @@ func getPrismCentralV4ClientForCluster(ctx context.Context, cluster *infrav1.Nut

// isPrismCentralV4Compatible checks if the Prism Central is v4 API compatible
func isPrismCentralV4Compatible(ctx context.Context, v3Client *prismclientv3.Client) (bool, error) {
log := ctrl.LoggerFrom(ctx)
internalPCNames := []string{"master", "fraser"}
pcVersion, err := getPrismCentralVersion(ctx, v3Client)

Check warning on line 822 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L820-L822

Added lines #L820 - L822 were not covered by tests
if err != nil {
return false, fmt.Errorf("failed to get Prism Central version: %w", err)
Expand All @@ -830,6 +832,15 @@ func isPrismCentralV4Compatible(ctx context.Context, v3Client *prismclientv3.Cli
return false, errors.New("version is empty")
}

Check warning on line 834 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L834

Added line #L834 was not covered by tests
for _, internalPCName := range internalPCNames {
// TODO(sid): This is a naive check to see if the PC version is an internal build. This can potentially lead to failures
// if internal fraser build is not v4 compatible.
if strings.Contains(pcVersion, internalPCName) {

Check warning on line 838 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L836-L838

Added lines #L836 - L838 were not covered by tests
log.Info(fmt.Sprintf("Prism Central version %s is an internal build; assuming it is v4 compatible", pcVersion))
return true, nil
}
}

// Remove the prefix "pc."

Check warning on line 844 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L842-L844

Added lines #L842 - L844 were not covered by tests
version := strings.TrimPrefix(pcVersion, "pc.")
// Split the version string by "." to extract the year part
Expand Down

0 comments on commit 103cda4

Please sign in to comment.