From ccc274fa0ffa02eb68fa8536dde68f88dd359a24 Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Tue, 5 Jun 2018 16:31:29 -0400 Subject: [PATCH] pep8 --- filebeat/tests/system/test_modules.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/filebeat/tests/system/test_modules.py b/filebeat/tests/system/test_modules.py index 917f5809fff..37b199715a4 100644 --- a/filebeat/tests/system/test_modules.py +++ b/filebeat/tests/system/test_modules.py @@ -130,7 +130,8 @@ def run_on_file(self, module, fileset, test_file, cfgfile): "-c", cfgfile, "-modules={}".format(module), "-M", "{module}.*.enabled=false".format(module=module), - "-M", "{module}.{fileset}.enabled=true".format(module=module, fileset=fileset), + "-M", "{module}.{fileset}.enabled=true".format( + module=module, fileset=fileset), "-M", "{module}.{fileset}.var.paths=[{test_file}]".format( module=module, fileset=fileset, test_file=test_file), "-M", "*.*.input.close_eof=true", @@ -157,7 +158,8 @@ def run_on_file(self, module, fileset, test_file, cfgfile): assert obj["fileset"]["module"] == module, "expected fileset.module={} but got {}".format( module, obj["fileset"]["module"]) - assert "error" not in obj, "not error expected but got: {}".format(obj) + assert "error" not in obj, "not error expected but got: {}".format( + obj) if (module == "auditd" and fileset == "log") \ or (module == "osquery" and fileset == "result"): @@ -248,13 +250,16 @@ def _run_ml_test(self, setup_flag, modules_flag): # Clean any previous state for df in self.es.transport.perform_request("GET", "/_xpack/ml/datafeeds/")["datafeeds"]: if df["datafeed_id"] == 'filebeat-nginx-access-response_code': - self.es.transport.perform_request("DELETE", "/_xpack/ml/datafeeds/" + df["datafeed_id"]) + self.es.transport.perform_request( + "DELETE", "/_xpack/ml/datafeeds/" + df["datafeed_id"]) for df in self.es.transport.perform_request("GET", "/_xpack/ml/anomaly_detectors/")["jobs"]: if df["job_id"] == 'datafeed-filebeat-nginx-access-response_code': - self.es.transport.perform_request("DELETE", "/_xpack/ml/anomaly_detectors/" + df["job_id"]) + self.es.transport.perform_request( + "DELETE", "/_xpack/ml/anomaly_detectors/" + df["job_id"]) - shutil.rmtree(os.path.join(self.working_dir, "modules.d"), ignore_errors=True) + shutil.rmtree(os.path.join(self.working_dir, + "modules.d"), ignore_errors=True) # generate a minimal configuration cfgfile = os.path.join(self.working_dir, "filebeat.yml") @@ -322,5 +327,6 @@ def _run_ml_test(self, setup_flag, modules_flag): beat.kill() + def pretty_json(obj): - return json.dumps(obj, indent=2, separators=(',',': ')) + return json.dumps(obj, indent=2, separators=(',', ': '))