Skip to content

Commit c4912de

Browse files
committed
MB-63312: Merge branch 'couchbase/cypher' into master
* MB-63312: Remove old assertion + fix passthrough Change-Id: I7cebc111412400b254017034813138b1540c26ef
2 parents c54fefd + 4285ad8 commit c4912de

File tree

1 file changed

+28
-12
lines changed

1 file changed

+28
-12
lines changed

cbcollect_info

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,6 @@ class RedactStream(Writer):
585585
# it so we don't write it again
586586
if self._wraparound:
587587
combined = f"{''.join(self._wraparound)}{line}"
588-
assert(combined.endswith(os.linesep))
589588
written = written + \
590589
write_readable_buffer(self.process_line(combined),
591590
self._inner)
@@ -1208,11 +1207,23 @@ class TaskRunner:
12081207
return
12091208

12101209
if self.redacted_zip_out:
1211-
if (metatask.output_file not in OMIT_IN_REDACT_ZIP and
1212-
not metatask.never_redact):
1213-
self._write_both(metatask)
1210+
if metatask.output_file not in OMIT_IN_REDACT_ZIP:
1211+
if metatask.never_redact:
1212+
self._write_double_passthrough(metatask)
1213+
else:
1214+
# this is the main redacted path
1215+
self._write_both(metatask)
12141216
else:
1215-
self._write_unredacted(metatask)
1217+
if metatask.never_redact:
1218+
# Currently this won't get called unless the task that grabs
1219+
# user.dets also included the never_redact=True flag.
1220+
# That said, if we wanted to set never_redact=True it should
1221+
# probably work for user.dets as well, whether we want to
1222+
# actually do that or not.
1223+
self._write_double_passthrough(metatask)
1224+
else:
1225+
# only users.dets right now
1226+
self._write_unredacted(metatask)
12161227
else:
12171228
self._write_unredacted(metatask)
12181229

@@ -1221,18 +1232,23 @@ class TaskRunner:
12211232
self._run_metatask(artifact)
12221233

12231234
def _write_both(self, metatask: MetaTask):
1224-
if self.redacted_zip_out:
1225-
with self.redacted_zip_out.open(metatask.output_file) as rlogfile:
1226-
redact = RedactStream(rlogfile, self.salt_value,
1227-
metatask.output_file)
1228-
with self.zip_out.open(metatask.output_file) as logfile:
1229-
double = DoubleStream(redact, logfile)
1230-
metatask.execute_all(double)
1235+
with self.redacted_zip_out.open(metatask.output_file) as rlogfile:
1236+
redact = RedactStream(rlogfile, self.salt_value,
1237+
metatask.output_file)
1238+
with self.zip_out.open(metatask.output_file) as logfile:
1239+
double = DoubleStream(redact, logfile)
1240+
metatask.execute_all(double)
12311241

12321242
def _write_unredacted(self, metatask: MetaTask):
12331243
with self.zip_out.open(metatask.output_file) as logfile:
12341244
metatask.execute_all(logfile)
12351245

1246+
def _write_double_passthrough(self, metatask: MetaTask):
1247+
with self.redacted_zip_out.open(metatask.output_file) as rlogfile:
1248+
with self.zip_out.open(metatask.output_file) as logfile:
1249+
double = DoubleStream(rlogfile, logfile)
1250+
metatask.execute_all(double)
1251+
12361252

12371253
def make_curl_task(name, get_creds_fun, url, method="GET",
12381254
timeout=60, log_file=DEFAULT_LOG, base_task=AllOsTask,

0 commit comments

Comments
 (0)