Skip to content

Conversation

@jfsiii
Copy link
Contributor

@jfsiii jfsiii commented Jul 24, 2020

Summary

fixes #66388

  • Respond with a 404 when a given package config id cannot be found

  • Added test to confirm 404

  • Changed AgentConfigService.delete to not throw if a default config isn't present. Behavior & reasoning described in b4f4051. I created a separate PR and added a test in [Ingest Manager] Fix /agent_config/delete API 500 if default config missing #73376 if we want to deal with it separately. I could also close that and bring the test over to this branch.

  • Updated the expected text in an Endpoint UI test

Checklist

Delete any items that are not applicable to this PR.

John Schulz added 3 commits July 24, 2020 13:22
Currently failing with a 500 as in #66388
The test initally failed with a 500 when the `after` was added. Debugging narrowed it down to a missing default config.

getDefaultAgentConfigId errors if there isn't a default config.  The config is added by `setupIngestManager` which _was_ always called during plugin#start but is no longer.

We could add the setup call to the test/suite, but instead I changed AgentConfigService.delete to use ensureDefaultAgentConfig instead of getDefaultAgentConfigId.

ensureDefaultAgentConfig adds one if it's missing. The check in delete is to make sure we don't delete the default config. We can still do that and now we add a config if it wasn't already there (which seems like A Good Thing)
@jfsiii jfsiii added the Team:Fleet Team label for Observability Data Collection Fleet team label Jul 24, 2020
@jfsiii jfsiii requested a review from nchaulet July 24, 2020 18:35
@jfsiii jfsiii changed the title [Ingest Manager] Fix API response on when package config id is missing #66388 [Ingest Manager] API sends 404 when package config id is missing #66388 Jul 25, 2020
@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 25, 2020

cc @elastic/endpoint-app-team for the text change in https://github.com/elastic/kibana/pull/73212/files#diff-d892c26bb4fc08d103899f8234beb2d4

@jfsiii jfsiii marked this pull request as ready for review July 25, 2020 15:10
@jfsiii jfsiii requested a review from a team as a code owner July 25, 2020 15:10
@jfsiii jfsiii requested a review from a team July 25, 2020 15:10
@jfsiii jfsiii requested a review from a team as a code owner July 25, 2020 15:10
@elasticmachine
Copy link
Contributor

Pinging @elastic/ingest-management (Team:Ingest Management)

@jfsiii jfsiii changed the title [Ingest Manager] API sends 404 when package config id is missing #66388 [Ingest Manager] API sends 404 when package config id is missing Jul 25, 2020
@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 25, 2020

@elasticmachine merge upstream

import { TypeOf } from '@kbn/config-schema';
import Boom from 'boom';
import { RequestHandler } from 'src/core/server';
import { RequestHandler, SavedObjectsErrorHelpers } from '../../../../../../src/core/server';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the relative path here because I was getting an error like "cannot find module 'src/core/server'" when I added the helpers

@jfsiii jfsiii added release_note:skip Skip the PR/issue when compiling release notes v7.10.0 v7.9.0 labels Jul 25, 2020
@jfsiii jfsiii self-assigned this Jul 26, 2020
@jen-huang jen-huang added v8.0.0 and removed v7.9.0 labels Jul 27, 2020
@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 27, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 27, 2020

@jen-huang I figured this would be backported to 7.9 because it's a bug fix for #66388

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 27, 2020

Spun the change in /agent_configs/delete behavior into separate PR #73376 if we'd rather deal with it separately

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 28, 2020

@jen-huang I figured this would be backported to 7.9 because it's a bug fix for #66388

We just got an email from @ph that only blockers should be backported to 7.9. This isn't a blocker.

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 28, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 28, 2020

@elasticmachine merge upstream

@jfsiii
Copy link
Contributor Author

jfsiii commented Jul 28, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jfsiii jfsiii merged commit 89a392b into elastic:master Jul 28, 2020
jfsiii pushed a commit that referenced this pull request Jul 29, 2020
) (#73659)

* Add test to confirm missing config responds w/ 404

Currently failing with a 500 as in #66388

* Use after() to remove items added by test.

The test initally failed with a 500 when the `after` was added. Debugging narrowed it down to a missing default config.

getDefaultAgentConfigId errors if there isn't a default config.  The config is added by `setupIngestManager` which _was_ always called during plugin#start but is no longer.

We could add the setup call to the test/suite, but instead I changed AgentConfigService.delete to use ensureDefaultAgentConfig instead of getDefaultAgentConfigId.

ensureDefaultAgentConfig adds one if it's missing. The check in delete is to make sure we don't delete the default config. We can still do that and now we add a config if it wasn't already there (which seems like A Good Thing)

* Fix package config path in OpenApi spec

* Return 404 if package config id is invalid/missing

* Change test for error displayed text

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.10.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Ingest] calling GET /api/ingest_manager/datasources/{id} with an invalid id causes an HTTP 500 error

6 participants