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

[Tooling] Check hard-coded category fields in asciidoc_fields.page_field_values don't conflict with custom schemas #1426

Closed
djptek opened this issue May 20, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@djptek
Copy link
Contributor

djptek commented May 20, 2021

Description of the problem including expected versus actual behavior:

asciidoc_fields.py fails if hard-coded category fields in asciidoc_fields.page_field_values were removed by e.g. a custom schema

Steps to reproduce:

python scripts/generator.py --exclude=schemas/event.yml
Loading schemas from local files
Running generator. ECS version 2.0.0-dev
Traceback (most recent call last):
  File "scripts/generator.py", line 107, in <module>
    main()
  File "scripts/generator.py", line 66, in main
    asciidoc_fields.generate(nested, ecs_generated_version, docs_dir)
  File "/Users/djptek/git/ecs/scripts/generators/asciidoc_fields.py", line 13, in generate
    save_asciidoc(path.join(out_dir, 'field-values.asciidoc'), page_field_values(nested))
  File "/Users/djptek/git/ecs/scripts/generators/asciidoc_fields.py", line 94, in decorated_function
    ctx = func(*args, **kwargs)
  File "/Users/djptek/git/ecs/scripts/generators/asciidoc_fields.py", line 175, in page_field_values
    nested_fields.append(nested['event']['fields'][cat_field])
KeyError: 'event'

Provide logs (if relevant):

n/a

Any additional context:

moot while --exclude PR not merged

@djptek djptek added the bug Something isn't working label May 20, 2021
@djptek djptek self-assigned this May 20, 2021
@ebeahan
Copy link
Member

ebeahan commented May 20, 2021

We skip the docs when either the --subset and --include arguments are used, with the AsciiDoc generator being particular to generating the ECS docs.

We could handle this the same way as --subset or --include: exiting out early if the --exclude arg is used:

https://github.com/elastic/ecs/blob/master/scripts/generator.py#L60

@djptek
Copy link
Contributor Author

djptek commented May 20, 2021

Thanks, I'll give it a try soon as I'm done with test updates

@djptek
Copy link
Contributor Author

djptek commented May 20, 2021

solved, thx @ebeahan

@djptek djptek closed this as completed May 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants