Skip to content

Commit 2723e16

Browse files
committed
fix some minor formatting issues; remove old asciidoc
The generate script should ignore the group name "Default" for the purpose of generating the structure used in the index template and pattern. Rearranged the kubernetes fields to make more sense in the asciidoc. Removed the old asciidoc from git.
1 parent 6eaf0cf commit 2723e16

File tree

5 files changed

+19
-705
lines changed

5 files changed

+19
-705
lines changed

namespaces/kubernetes.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,6 @@ namespace:
1212
description: >
1313
The name of the pod
1414
15-
- name: labels
16-
type: group
17-
description: >
18-
Labels attached to the OpenShift object
19-
Each label name is a subfield of labels field.
20-
Each label name is de-dotted: dots in the name are replaced with
21-
underscores.
22-
2315
- name: pod_id
2416
type: string
2517
norms:
@@ -58,5 +50,13 @@ namespace:
5850
description: >
5951
Annotations associated with the OpenShift object
6052
53+
- name: labels
54+
type: group
55+
description: >
56+
Labels attached to the OpenShift object
57+
Each label name is a subfield of labels field.
58+
Each label name is de-dotted: dots in the name are replaced with
59+
underscores.
60+
6161
doc_sections:
6262
- ["pod_log", "Openshift logging metadata"]

namespaces/systemd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ namespace:
111111
112112
- name: SOURCE_REALTIME_TIMESTAMP
113113
type: string
114-
description: >
114+
description: |
115115
https://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html#_SOURCE_REALTIME_TIMESTAMP=
116116
This is converted to RFC 3339 NS format
117117

scripts/concat-index-pattern-fields.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ def removedupnames(fieldary):
2727
docfieldary = removedupnames(json.loads(doc['fields']))
2828
doc['fields'] = json.dumps(docfieldary)
2929
sys.stdout.write(json.dumps(doc, indent=4, sort_keys=True, separators=(',', ': ')))
30+
sys.stdout.write('\n')

scripts/generate_template.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def object_types_to_template(template_definition, output, output_index_pattern,
6262
# in the group, and other settings applicable to groups such as
6363
# include_in_all, etc.
6464
skeleton['mappings']['_default_'].update(traverse_group_section(
65-
default_mapping, default_mapping_yml['field_defaults'], process_leaf))
65+
default_mapping, default_mapping_yml['field_defaults'], process_leaf, True))
6666

6767
add_type_version(default_mapping_yml["version"],
6868
skeleton['mappings']['_default_'])
@@ -90,7 +90,7 @@ def object_types_to_template(template_definition, output, output_index_pattern,
9090
skeleton_index_pattern["description"] = skeleton_index_pattern["description"].replace("<the_index_type>", template_definition['elasticsearch_template']['index_pattern'])
9191
# get fields
9292
index_pattern_fields = (traverse_group_section_index_pattern(
93-
default_mapping, default_mapping_yml['field_defaults'], process_leaf_index_pattern))
93+
default_mapping, default_mapping_yml['field_defaults'], process_leaf_index_pattern, None, True))
9494
skeleton_index_pattern["fields"] = json.dumps(index_pattern_fields)
9595
json.dump(
9696
skeleton_index_pattern, output_index_pattern, indent=2, separators=(',', ': '), sort_keys=True)
@@ -119,7 +119,7 @@ def add_index_template_fields(rec):
119119
return ret
120120

121121

122-
def traverse_group_section(group, leaf_defaults, leaf_handler):
122+
def traverse_group_section(group, leaf_defaults, leaf_handler, toplevel=False):
123123
"""
124124
Traverse the sections tree and fill in the properties
125125
map.
@@ -135,10 +135,10 @@ def traverse_group_section(group, leaf_defaults, leaf_handler):
135135
parameters
136136
"""
137137
field = add_index_template_fields(group)
138-
if 'name' in group:
139-
ret = {group['name']: field}
140-
else:
138+
if toplevel or not 'name' in group:
141139
ret = field
140+
else:
141+
ret = {group['name']: field}
142142
if group['type'] == 'group':
143143
fieldskey = 'properties'
144144
del field['type']
@@ -190,7 +190,7 @@ def process_leaf(field, defaults):
190190
print("Unknown field. Skipped adding field {}".format(field))
191191

192192

193-
def traverse_group_section_index_pattern(group, defaults, leaf_handler, groupname=None):
193+
def traverse_group_section_index_pattern(group, defaults, leaf_handler, groupname=None, toplevel=False):
194194
"""
195195
Traverse the sections tree and fill in the index pattern fields
196196
map.
@@ -208,6 +208,8 @@ def traverse_group_section_index_pattern(group, defaults, leaf_handler, groupnam
208208
for field in group["fields"]:
209209
if groupname:
210210
subgroupname = groupname + "." + group["name"]
211+
elif toplevel:
212+
subgroupname = None
211213
else:
212214
subgroupname = group.get("name", None)
213215
if field.get("type") == "group":

0 commit comments

Comments
 (0)