fleet icon indicating copy to clipboard operation
fleet copied to clipboard

Add "exclude software" parameter to get host by identifier

Open jamesfkane opened this issue 1 year ago • 3 comments

Just added the same "exclude_software" functionality that exists in "get hosts" to the "get host by identifier" function.

  • [ ] Changes file added for user-visible changes in changes/, orbit/changes/ or ee/fleetd-chrome/changes. See Changes files for more information.
  • [ ] Manual QA for all new/changed functionality

jamesfkane avatar Jul 01 '24 20:07 jamesfkane

Thanks @jamesfkane!! Looks like we have a couple minor edits to get this over the line. I'll take a closer look.

mostlikelee avatar Jul 01 '24 21:07 mostlikelee

@mostlikelee Not confident (my first foray into Go), but took a crack at it. Appreciate the pointers!

jamesfkane avatar Jul 01 '24 23:07 jamesfkane

@mostlikelee This PR fixes #19540

getvictor avatar Jul 02 '24 12:07 getvictor

Thanks for your contribution, @jamesfkane!

@noahtalerman This PR adds an optional exclude_software parameter to the get host by identifier endpoint, which is consistent with the get host endpoint. Because this qualifies as a product change, I'm sending the PR across the product board for review. If the change is approved, we'll create a user story defining the change and any reference docs that require update.

lukeheath avatar Jul 09 '24 16:07 lukeheath

@noahtalerman Actually we already have a user story for this change.

lukeheath avatar Jul 09 '24 16:07 lukeheath

@mostlikelee I could never get to the bottom of why the infrastructure tests started failing on one of the pre-existing steps once I added the additional tests. If it's not too much of an ask, I'd love to understand what I'm missing!

Appreciate you all!

Looks like the test is failing here:

integration_core_test.go

Error:

2024-07-02T00:48:16.6653073Z === RUN   TestIntegrations/TestGetHostSoftwareUpdatedAt
2024-07-02T00:48:16.6654196Z level=debug [email protected] method=GET uri=/api/latest/fleet/hosts/54 took=21.709893ms
2024-07-02T00:48:16.6655705Z level=debug [email protected] method=GET uri=/api/latest/fleet/hosts/54 took=26.406399ms
2024-07-02T00:48:16.6657337Z level=debug [email protected] method=GET uri="/api/latest/fleet/hosts/54?exclude_software=true" took=17.963602ms
2024-07-02T00:48:16.6659774Z     testing_client.go:254: Error trying to decode response body as Fleet jsonError: json: cannot unmarshal number into Go value of type service.jsonError
2024-07-02T00:48:16.6661294Z     testing_client.go:255: 
2024-07-02T00:48:16.6662503Z         	Error Trace:	/home/runner/work/fleet/fleet/server/service/testing_client.go:255
2024-07-02T00:48:16.6664490Z         	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:264
2024-07-02T00:48:16.6666409Z         	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:209
2024-07-02T00:48:16.6668267Z         	            				/home/runner/work/fleet/fleet/server/service/testing_client.go:274
2024-07-02T00:48:16.6670867Z         	            				/home/runner/work/fleet/fleet/server/service/integration_core_test.go:7972
2024-07-02T00:48:16.6671889Z         	Error:      	Not equal: 
2024-07-02T00:48:16.6672577Z         	            	expected: 200
2024-07-02T00:48:16.6673267Z         	            	actual  : 404
2024-07-02T00:48:16.6674108Z         	Test:       	TestIntegrations/TestGetHostSoftwareUpdatedAt
2024-07-02T00:48:16.6678972Z         	Messages:   	response: &{Status:404 Not Found StatusCode:404 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Content-Length:[19] Content-Type:[text/plain; charset=utf-8] Date:[Tue, 02 Jul 2024 00:44:26 GMT] X-Content-Type-Options:[nosniff]] Body:0xc00165bac0 ContentLength:19 TransferEncoding:[] Close:false Uncompressed:false Trailer:map[] Request:0xc00203be60 TLS:<nil>}

Edit: add more from debug log for better context

jamesfkane avatar Jul 09 '24 17:07 jamesfkane

I'm sending the PR across the product board for review. If the change is approved, we'll create a user story defining the change and any reference docs that require update.

Followed up in the user story here: https://github.com/fleetdm/fleet/issues/19540#issuecomment-2218679909

noahtalerman avatar Jul 09 '24 21:07 noahtalerman

@mostlikelee We need your approval to merge. Thanks!

lukeheath avatar Jul 09 '24 22:07 lukeheath

Just noticed that a setting I have enabled in vs code removed trailing whitespace in other parts of the API readme. Overall maybe a positive change, but out of scope of this PR. Apologies for not checking prior to committing! Let me know if you want me to revert.

jamesfkane avatar Jul 09 '24 23:07 jamesfkane

Actually we already have a https://github.com/fleetdm/fleet/issues/19540.

Pulling this PR off of the drafting board (removing :product)

noahtalerman avatar Jul 10 '24 19:07 noahtalerman