Skip to content

Commit

Permalink
Adjust terminology - change whitelist to allowlist (#1315) (#1331)
Browse files Browse the repository at this point in the history
Co-authored-by: Dominic Page <11043991+djptek@users.noreply.github.com>
  • Loading branch information
ebeahan and djptek authored Mar 29, 2021
1 parent 9a677e1 commit 56f6e31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.next.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ Thanks, you're awesome :-) -->
* `user.changes.*`, `user.effective.*`, and `user.target.*` field reuses are GA. #1271
* Update Python dependencies #1310, #1318

### Tooling and Artifact Changes

#### Improvements

* Adjustments to use terminology that doesn't have negative connotation. #1315

<!-- All empty sections:
## Unreleased
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

0 comments on commit 56f6e31

Please sign in to comment.