update beats master branch ref to main (#1853)

* update beats master branch ref to main

* update filename of master beat schema to main

* delete old main beats schema

* rebuilt main beats archive
This commit is contained in:
Mika Ayenson
2022-03-18 10:06:34 -04:00
committed by GitHub
parent 7feebc2c10
commit 84b7ce6582
5 changed files with 10 additions and 10 deletions
+6 -6
View File
@@ -95,9 +95,9 @@ def download_latest_beats_schema():
download_beats_schema(latest_release["tag_name"])
def refresh_master_schema():
"""Download and refresh beats schema from master."""
_decompress_and_save_schema('https://github.com/elastic/beats/archive/master.zip', 'master')
def refresh_main_schema():
"""Download and refresh beats schema from main."""
_decompress_and_save_schema('https://github.com/elastic/beats/archive/main.zip', 'main')
def _flatten_schema(schema: list, prefix="") -> list:
@@ -123,7 +123,7 @@ def _flatten_schema(schema: list, prefix="") -> list:
elif "name" in s:
s = s.copy()
# type is implicitly keyword if not defined
# example: https://github.com/elastic/beats/blob/master/packetbeat/_meta/fields.common.yml#L7-L12
# example: https://github.com/elastic/beats/blob/main/packetbeat/_meta/fields.common.yml#L7-L12
s.setdefault("type", "keyword")
s["name"] = prefix + s["name"]
flattened.append(s)
@@ -198,8 +198,8 @@ def get_max_version() -> str:
@cached
def read_beats_schema(version: str = None):
if version and version.lower() == 'master':
return json.loads(read_gzip(get_etc_path('beats_schemas', 'master.json.gz')))
if version and version.lower() == 'main':
return json.loads(read_gzip(get_etc_path('beats_schemas', 'main.json.gz')))
version = Version(version) if version else None
beats_schemas = get_versions()