Skip to content

Commit ad93766

Browse files
authored
Merge pull request #44 from stackhpc/salt_redact_fix
feat: add support for exceptions to annotations
2 parents 8b5e98a + 024b83e commit ad93766

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

utils/kayobe-automation-redact

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,23 @@ import hashlib
55
import base64
66
import sys
77

8+
annotation_exceptions = {
9+
'prometheus_bcrypt_salt': {'original': 'prometheusbcryptsalt.o', 'changed': 'prometheusbcryptsalt.c'},
10+
}
11+
12+
813
def annotate(ctx, value):
9-
if not isinstance(value, str):
10-
return value
11-
path_str = map(str, ctx['path'])
12-
return f"{'.'.join(path_str)}.{ value }"
14+
if not isinstance(value, str):
15+
return value
16+
path_str = *map(str, ctx['path']),
17+
if path_str[0] in annotation_exceptions:
18+
if isinstance(annotation_exceptions[path_str[0]], str):
19+
return annotation_exceptions[path_str[0]]
20+
else:
21+
return annotation_exceptions[path_str[0]][value]
22+
else:
23+
return f"{'_'.join(path_str)}.{value}"
24+
1325

1426
def redact_int(ctx, x):
1527
# For numbers we can't indicate change with a string, so use sentinal values

0 commit comments

Comments
 (0)