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 4926a09
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 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)
if err != nil {
return false, fmt.Errorf("failed to get Prism Central version: %w", err)

Check warning on line 824 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L820-L824

Added lines #L820 - L824 were not covered by tests
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 832 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L831-L832

Added lines #L831 - L832 were not covered by tests
}

for _, internalPCName := range internalPCNames {

Check warning on line 835 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L835

Added line #L835 was not covered by tests
// 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) {
log.Info(fmt.Sprintf("Prism Central version %s is an internal build; assuming it is v4 compatible", pcVersion))
return true, nil

Check warning on line 840 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L838-L840

Added lines #L838 - L840 were not covered by tests
}
}

// Remove the prefix "pc."
version := strings.TrimPrefix(pcVersion, "pc.")

Check warning on line 845 in controllers/helpers.go

View check run for this annotation

Codecov / codecov/patch

controllers/helpers.go#L845

Added line #L845 was not covered by tests
// Split the version string by "." to extract the year part
Expand Down
2 changes: 1 addition & 1 deletion devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"[email protected]",
"fping@latest",
"[email protected]",
"ginkgo@2.17.0",
"ginkgo@2.19.0",
"[email protected]",
"[email protected]",
"kubernetes-helm@latest",
Expand Down
24 changes: 12 additions & 12 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,51 +181,51 @@
}
}
},
"ginkgo@2.17.0": {
"last_modified": "2024-03-19T05:49:19Z",
"resolved": "github:NixOS/nixpkgs/5710127d9693421e78cca4f74fac2db6d67162b1#ginkgo",
"ginkgo@2.19.0": {
"last_modified": "2024-07-07T07:43:47Z",
"resolved": "github:NixOS/nixpkgs/b60793b86201040d9dee019a05089a9150d08b5b#ginkgo",
"source": "devbox-search",
"version": "2.17.0",
"version": "2.19.0",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/lxq0cx9km60yjwf63pmf1j3rbfr82q7x-ginkgo-2.17.0",
"path": "/nix/store/0df3v1l69507ch21m4f5yjmqph6njr2a-ginkgo-2.19.0",
"default": true
}
],
"store_path": "/nix/store/lxq0cx9km60yjwf63pmf1j3rbfr82q7x-ginkgo-2.17.0"
"store_path": "/nix/store/0df3v1l69507ch21m4f5yjmqph6njr2a-ginkgo-2.19.0"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/1bf8v0b9k0pmmrs06h6zw13cxl0pmd9q-ginkgo-2.17.0",
"path": "/nix/store/n71yvwix1rkji7y2p0hird6rzxnb7hly-ginkgo-2.19.0",
"default": true
}
],
"store_path": "/nix/store/1bf8v0b9k0pmmrs06h6zw13cxl0pmd9q-ginkgo-2.17.0"
"store_path": "/nix/store/n71yvwix1rkji7y2p0hird6rzxnb7hly-ginkgo-2.19.0"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/7qyd3jfipsx9gj0wbkms245hkidlfb0f-ginkgo-2.17.0",
"path": "/nix/store/hhr3kz63pcpvbrhlsvwrriqwdkyqi1dw-ginkgo-2.19.0",
"default": true
}
],
"store_path": "/nix/store/7qyd3jfipsx9gj0wbkms245hkidlfb0f-ginkgo-2.17.0"
"store_path": "/nix/store/hhr3kz63pcpvbrhlsvwrriqwdkyqi1dw-ginkgo-2.19.0"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/bavqnxdhcvlpmkjvd0hcnhj3dlrrysmc-ginkgo-2.17.0",
"path": "/nix/store/8dkncfjlj1iavhvc5bym480c9asazlgh-ginkgo-2.19.0",
"default": true
}
],
"store_path": "/nix/store/bavqnxdhcvlpmkjvd0hcnhj3dlrrysmc-ginkgo-2.17.0"
"store_path": "/nix/store/8dkncfjlj1iavhvc5bym480c9asazlgh-ginkgo-2.19.0"
}
}
},
Expand Down

0 comments on commit 4926a09

Please sign in to comment.