Skip to content

Commit

Permalink
Merge pull request #44 from stackhpc/salt_redact_fix
Browse files Browse the repository at this point in the history
feat: add support for exceptions to annotations
  • Loading branch information
jackhodgkiss authored Jun 26, 2024
2 parents 8b5e98a + 024b83e commit ad93766
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions utils/kayobe-automation-redact
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@ import hashlib
import base64
import sys

annotation_exceptions = {
'prometheus_bcrypt_salt': {'original': 'prometheusbcryptsalt.o', 'changed': 'prometheusbcryptsalt.c'},
}


def annotate(ctx, value):
if not isinstance(value, str):
return value
path_str = map(str, ctx['path'])
return f"{'.'.join(path_str)}.{ value }"
if not isinstance(value, str):
return value
path_str = *map(str, ctx['path']),
if path_str[0] in annotation_exceptions:
if isinstance(annotation_exceptions[path_str[0]], str):
return annotation_exceptions[path_str[0]]
else:
return annotation_exceptions[path_str[0]][value]
else:
return f"{'_'.join(path_str)}.{value}"


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

0 comments on commit ad93766

Please sign in to comment.