From a1a2debe6f23f68e3e45717d6af6ea23fd90df76 Mon Sep 17 00:00:00 2001 From: Eric Beahan Date: Mon, 29 Mar 2021 10:36:14 -0500 Subject: [PATCH] Adjust terminology - change whitelist to allowlist (#1315) (#1330) Co-authored-by: Dominic Page <11043991+djptek@users.noreply.github.com> --- CHANGELOG.next.md | 1 + scripts/generators/beats.py | 16 ++++++++-------- ...st.yml => beats_default_fields_allowlist.yml} | 0 3 files changed, 9 insertions(+), 8 deletions(-) rename scripts/generators/{beats_default_fields_whitelist.yml => beats_default_fields_allowlist.yml} (100%) diff --git a/CHANGELOG.next.md b/CHANGELOG.next.md index ad3342c3b5..04bade1272 100644 --- a/CHANGELOG.next.md +++ b/CHANGELOG.next.md @@ -34,6 +34,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 diff --git a/scripts/generators/beats.py b/scripts/generators/beats.py index fa8904c058..6f70921f67 100644 --- a/scripts/generators/beats.py +++ b/scripts/generators/beats.py @@ -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 @@ -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() @@ -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', @@ -56,7 +56,7 @@ 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)) @@ -64,7 +64,7 @@ def fieldset_field_array(source_fields, df_whitelist, fieldset_prefix): 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) diff --git a/scripts/generators/beats_default_fields_whitelist.yml b/scripts/generators/beats_default_fields_allowlist.yml similarity index 100% rename from scripts/generators/beats_default_fields_whitelist.yml rename to scripts/generators/beats_default_fields_allowlist.yml