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

Adjust terminology - change whitelist to allowlist #1315

Merged
merged 4 commits into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Thanks, you're awesome :-) -->
#### Improvements

* Go code generator now supports the `flattened` data type. #1302
* Adjustments to use terminology that doesn't have negative connotation. #1315

#### Deprecated

Expand Down
16 changes: 8 additions & 8 deletions scripts/generators/beats.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@


def generate(ecs_nested, ecs_version, out_dir):
# Load temporary whitelist for default_fields workaround.
df_whitelist = ecs_helpers.yaml_load('scripts/generators/beats_default_fields_whitelist.yml')
# Load temporary allowlist for default_fields workaround.
df_allowlist = ecs_helpers.yaml_load('scripts/generators/beats_default_fields_allowlist.yml')

# base first
beats_fields = fieldset_field_array(ecs_nested['base']['fields'], df_whitelist, ecs_nested['base']['prefix'])
beats_fields = fieldset_field_array(ecs_nested['base']['fields'], df_allowlist, ecs_nested['base']['prefix'])

allowed_fieldset_keys = ['name', 'title', 'group', 'description', 'footnote', 'type']
# other fieldsets
Expand All @@ -19,11 +19,11 @@ def generate(ecs_nested, ecs_version, out_dir):

# Handle when `root:true`
if fieldset.get('root', False):
beats_fields.extend(fieldset_field_array(fieldset['fields'], df_whitelist, fieldset['prefix']))
beats_fields.extend(fieldset_field_array(fieldset['fields'], df_allowlist, fieldset['prefix']))
continue

beats_field = ecs_helpers.dict_copy_keys_ordered(fieldset, allowed_fieldset_keys)
beats_field['fields'] = fieldset_field_array(fieldset['fields'], df_whitelist, fieldset['prefix'])
beats_field['fields'] = fieldset_field_array(fieldset['fields'], df_allowlist, fieldset['prefix'])
beats_fields.append(beats_field)

beats_file = OrderedDict()
Expand All @@ -35,7 +35,7 @@ def generate(ecs_nested, ecs_version, out_dir):
write_beats_yaml(beats_file, ecs_version, out_dir)


def fieldset_field_array(source_fields, df_whitelist, fieldset_prefix):
def fieldset_field_array(source_fields, df_allowlist, fieldset_prefix):
allowed_keys = ['name', 'level', 'required', 'type', 'object_type',
'ignore_above', 'multi_fields', 'format', 'input_format',
'output_format', 'output_precision', 'description',
Expand All @@ -56,15 +56,15 @@ def fieldset_field_array(source_fields, df_whitelist, fieldset_prefix):
for mf in ecs_field['multi_fields']:
# Set default_field if necessary. Avoid adding the key if the parent
# field already is marked with default_field: false.
if not mf['flat_name'] in df_whitelist and ecs_field['flat_name'] in df_whitelist:
if not mf['flat_name'] in df_allowlist and ecs_field['flat_name'] in df_allowlist:
mf['default_field'] = False
cleaned_multi_fields.append(
ecs_helpers.dict_copy_keys_ordered(mf, multi_fields_allowed_keys))
beats_field['multi_fields'] = cleaned_multi_fields

beats_field['name'] = contextual_name

if not ecs_field['flat_name'] in df_whitelist:
if not ecs_field['flat_name'] in df_allowlist:
beats_field['default_field'] = False

fields.append(beats_field)
Expand Down