Skip to content

Commit

Permalink
Fix yaml warnings in python scripts and tests (elastic#20606)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoriano authored and melchiormoulin committed Oct 14, 2020
1 parent e4f8606 commit ccdc49b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion auditbeat/scripts/docs_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def collect(base_paths):

# Load title from fields.yml
with open(beat_path + "/fields.yml") as f:
fields = yaml.load(f.read())
fields = yaml.load(f.read(), Loader=yaml.FullLoader)
title = fields[0]["title"]

modules_list[module] = title
Expand Down
2 changes: 1 addition & 1 deletion filebeat/scripts/docs_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def collect(beat_name):

# Load title from fields.yml
with open(beat_path + "/fields.yml", encoding='utf_8') as f:
fields = yaml.load(f.read())
fields = yaml.load(f.read(), Loader=yaml.FullLoader)
title = fields[0]["title"]

modules_list[module] = title
Expand Down
2 changes: 1 addition & 1 deletion libbeat/scripts/generate_fields_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def fields_to_asciidoc(input, output, beat):
""".format(**dict))

docs = yaml.load(input)
docs = yaml.load(input, Loader=yaml.FullLoader)

# fields file is empty
if docs is None:
Expand Down
2 changes: 1 addition & 1 deletion libbeat/tests/system/beat/common_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ def test_export_config(self):
Test that the config can be exported with `export config`
"""
output = self.run_export_cmd("config")
yml = yaml.load(output)
yml = yaml.load(output, Loader=yaml.FullLoader)
assert isinstance(yml, dict)
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ markers =

# Ignore setup and teardown for the timeout
timeout_func_only = True

filterwarnings =
error::yaml.YAMLLoadWarning
2 changes: 1 addition & 1 deletion script/config_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def collect(beat_name, beat_path, full=False):

# Load title from fields.yml
with open(beat_path + "/fields.yml") as f:
fields = yaml.load(f.read())
fields = yaml.load(f.read(), Loader=yaml.FullLoader)
title = fields[0]["title"]

# Check if short config was disabled in fields.yml
Expand Down
2 changes: 1 addition & 1 deletion winlogbeat/tests/system/winlogbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def read_events(self, config=None, expected_events=1):

def read_registry(self, requireBookmark=False):
f = open(os.path.join(self.working_dir, "data", ".winlogbeat.yml"), "r")
data = yaml.load(f)
data = yaml.load(f, Loader=yaml.FullLoader)
self.assertIn("update_time", data)
self.assertIn("event_logs", data)

Expand Down

0 comments on commit ccdc49b

Please sign in to comment.