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

[ES-ARCHIVER] Fix bug when query flag is empty #77983

Merged
merged 1 commit into from
Sep 22, 2020

Conversation

cnasikas
Copy link
Member

@cnasikas cnasikas commented Sep 21, 2020

Summary

This PR fixes a bug where you get an error if you do not pass the query flag. This is happening because the query flag, if not provided, defaults to an empty string and typeof query === 'string is always true.

Steps to reproduce:

  1. node scripts/es_archiver save your_name ".kibana"

Error:

--query should be valid JSON

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@cnasikas cnasikas added bug Fixes for quality problems that affect the customer experience v8.0.0 v7.10.0 labels Sep 21, 2020
@cnasikas cnasikas requested a review from dgieselaar September 21, 2020 09:41
@cnasikas cnasikas requested a review from a team as a code owner September 21, 2020 09:41
@cnasikas cnasikas self-assigned this Sep 21, 2020
@cnasikas cnasikas added the release_note:skip Skip the PR/issue when compiling release notes label Sep 21, 2020
@cnasikas cnasikas requested a review from spalger September 21, 2020 09:42
@cnasikas cnasikas added the Team:Operations Team label for Operations Team label Sep 21, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@@ -144,7 +144,7 @@ export function runCli() {

const query = flags.query;
let parsedQuery;
if (typeof query === 'string') {
if (typeof query === 'string' && query.length > 0) {
Copy link
Member

@dgieselaar dgieselaar Sep 21, 2020

Choose a reason for hiding this comment

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

This can perhaps be simplified to if (!query) {}, but I also like the explicitness of what you have.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks! I can change it to your proposal. It's up to you :)

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

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

LGTM, will defer to ops for a final decision ofc.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

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

@cnasikas cnasikas merged commit 13bd34e into elastic:master Sep 22, 2020
@cnasikas cnasikas deleted the es_archiver_fix branch September 22, 2020 07:12
cnasikas added a commit to cnasikas/kibana that referenced this pull request Sep 22, 2020
gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 22, 2020
* master: (45 commits)
  [CSM] Use stacked chart for page views (elastic#78042)
  [Enterprise Search] Fix various plugin states when app has error connecting to Enterprise Search (elastic#78091)
  Remove service map beta badge (elastic#78039)
  [Enterprise Search] Rename "telemetry" to "stats" (elastic#78124)
  [Alerting] optimize calculation of unmuted alert instances (elastic#78021)
  call .destroy on ace when react component unmounts (elastic#78132)
  [Ingest Manager] Fix agent action acknowledgement (elastic#78089)
  [Upgrade Assistant] Rename "telemetry" to "stats" (elastic#78127)
  [Security Solution] Refactor Hosts Kpi to use Search Strategy (elastic#77606)
  Bump backport to 5.6.0 (elastic#78097)
  [Actions] adds a Test Connector tab in the Connectors list (elastic#77365)
  [Uptime] Improve ping chart axis (elastic#77992)
  [TSVB] Fields dropdowns are not populated if one of the indices is missing (elastic#77363)
  [UiActions] Remove duplicate apply filter action  (elastic#77485)
  [APM] Use transaction metrics for transaction error rate (elastic#78009)
  [ES-ARCHIVER] Fix bug when query flag is empty (elastic#77983)
  Edit UI text strings in Integrations and Fleet tabs (elastic#75837)
  [baseline capture] switch to large workers (elastic#78109)
  [SECURITY_SOLUTION] list UI is backwards compatible (elastic#77956)
  [Mappings editor] Add support for point field type (elastic#77543)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Operations Team label for Operations Team v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants