Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering on the machines endpoint incorrectly filters on IsDisabled #8916

Closed
benPearce1 opened this issue Jul 18, 2024 · 3 comments
Closed
Assignees
Labels
kind/bug This issue represents a verified problem we are committed to solving

Comments

@benPearce1
Copy link

Severity

Blocking some customers, no workaround available

Version

Didn't check earlier versions

Latest Version

I could reproduce the problem in the latest build

What happened?

When calling the Machines List endpoint and filtering by IsDisabled the results are incorrect when setting IsDisabled=false.

Reproduction

For my current test setup:
image

http://localhost:8066/api/Spaces-1/machines?skip=0&take=2147483647&isDisabled=false returns all six targets

{
  ItemType: "Machine",
  TotalResults: 6,
  ItemsPerPage: 2147483647,
  NumberOfPages: 1,
  LastPageNumber: 0,
  Items: [ ... ]
}

http://localhost:8066/api/Spaces-1/machines?skip=0&take=2147483647&isDisabled=true returns just the two disabled ones:

{
  ItemType: "Machine",
  TotalResults: 2,
  ItemsPerPage: 2147483647,
  NumberOfPages: 1,
  LastPageNumber: 0,
  Items: [ ... ]

Error and Stacktrace

None errors produced

More Information

This is affecting the use of the Target Datasources in Terraform
OctopusDeployLabs/terraform-provider-octopusdeploy#624

Workaround

Filter on the client side, if possible.

@mjhilton
Copy link

mjhilton commented Sep 2, 2024

This seems to be a result of the way the Deployment Targets page was designed, which has the following behaviour:

  • Return all machines by default (which currently includes a default querystring value of isDisabled=false in the API request)
  • Returns only disabled machines if the "Disabled Only" filter is set (querystring isDisabled=true in the API request)

The API handler was written - probably many years ago - to mirror this behaviour, even though we have the isDisabled property as nullable, we always treat a false value the same way as null.

Fix would be to update the frontend to provide no querystring value when the filter is unticked, and to update the backend to respect the nullability of the property.

@octoreleasebot
Copy link

Release Note: Infrastructure APIs which use isDisabled parameter will now return all enabled items when isDisabled=false

@Octobob
Copy link
Member

Octobob commented Nov 8, 2024

🎉 The fix for this issue has been released in:

Release stream Release
2024.4 2024.4.4330
2025.1+ all releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug This issue represents a verified problem we are committed to solving
Projects
None yet
Development

No branches or pull requests

5 participants