Skip to content

Commit 73cf78d

Browse files
Handle consecutive secrets stored inrepo
This change improves the inrepo rotation by handling secrets stored next to each other. Change-Id: I221e980d3b99a75f32ffd23479ce615706f3bac9
1 parent bb25950 commit 73cf78d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

controllers/static/rotate-projects-private-keys.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,18 @@ def parse_yaml(txt):
104104
line = lines[pos]
105105
pos += 1
106106
if len(line) < indent or line[indent - 1] not in [" ", "\t"]:
107+
# This line is not part of the current secret.
108+
# It might be the beginning of another secret if they are next to each others.
109+
# So we go back one position so that it will be handled next
110+
pos -= 1
107111
break
108112
secret.append(line[indent:])
109113
yield (
110114
"ssh" if (is_ssh and name == "site_sflogs") else "sec",
111115
PKCS(indent, "\n".join(secret)),
112116
)
113-
yield ("raw", line)
117+
else:
118+
yield ("raw", line)
114119

115120

116121
def render_yaml(xs):

0 commit comments

Comments
 (0)