Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 1 | # Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """Field handler classes. |
| 6 | |
| 7 | The field handlers are meant to parse information from or do some other generic |
| 8 | action for a specific field type for the build_api script. |
| 9 | """ |
| 10 | |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 11 | import contextlib |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 12 | import functools |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 13 | import os |
| 14 | import shutil |
| 15 | |
Mike Frysinger | 2c02406 | 2021-05-22 15:43:22 -0400 | [diff] [blame] | 16 | from chromite.third_party.google.protobuf import message as protobuf_message |
Mike Frysinger | 849d640 | 2019-10-17 00:14:16 -0400 | [diff] [blame] | 17 | |
Alex Klein | 38c7d9e | 2019-05-08 09:31:19 -0600 | [diff] [blame] | 18 | from chromite.api.controller import controller_util |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 19 | from chromite.api.gen.chromiumos import common_pb2 |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 20 | from chromite.lib import cros_logging as logging |
| 21 | from chromite.lib import osutils |
| 22 | |
| 23 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 24 | class Error(Exception): |
| 25 | """Base error class for the module.""" |
| 26 | |
| 27 | |
| 28 | class InvalidResultPathError(Error): |
| 29 | """Result path is invalid.""" |
| 30 | |
| 31 | |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 32 | class ChrootHandler(object): |
| 33 | """Translate a Chroot message to chroot enter arguments and env.""" |
| 34 | |
Alex Klein | c7d647f | 2020-01-06 12:00:48 -0700 | [diff] [blame] | 35 | def __init__(self, clear_field): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 36 | self.clear_field = clear_field |
| 37 | |
Alex Klein | 6becabc | 2020-09-11 14:03:05 -0600 | [diff] [blame] | 38 | def handle(self, message, recurse=True): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 39 | """Parse a message for a chroot field.""" |
| 40 | # Find the Chroot field. Search for the field by type to prevent it being |
| 41 | # tied to a naming convention. |
| 42 | for descriptor in message.DESCRIPTOR.fields: |
| 43 | field = getattr(message, descriptor.name) |
| 44 | if isinstance(field, common_pb2.Chroot): |
| 45 | chroot = field |
| 46 | if self.clear_field: |
| 47 | message.ClearField(descriptor.name) |
| 48 | return self.parse_chroot(chroot) |
| 49 | |
Alex Klein | 6becabc | 2020-09-11 14:03:05 -0600 | [diff] [blame] | 50 | # Recurse down one level. This is handy for meta-endpoints that use another |
| 51 | # endpoint's request to produce data for or about the second endpoint. |
| 52 | # e.g. PackageService/NeedsChromeSource. |
| 53 | if recurse: |
| 54 | for descriptor in message.DESCRIPTOR.fields: |
| 55 | field = getattr(message, descriptor.name) |
| 56 | if isinstance(field, protobuf_message.Message): |
| 57 | chroot = self.handle(field, recurse=False) |
| 58 | if chroot: |
| 59 | return chroot |
| 60 | |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 61 | return None |
| 62 | |
| 63 | def parse_chroot(self, chroot_message): |
| 64 | """Parse a Chroot message instance.""" |
Alex Klein | c7d647f | 2020-01-06 12:00:48 -0700 | [diff] [blame] | 65 | return controller_util.ParseChroot(chroot_message) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 66 | |
| 67 | |
Alex Klein | c7d647f | 2020-01-06 12:00:48 -0700 | [diff] [blame] | 68 | def handle_chroot(message, clear_field=True): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 69 | """Find and parse the chroot field, returning the Chroot instance. |
| 70 | |
| 71 | Returns: |
| 72 | chroot_lib.Chroot |
| 73 | """ |
Alex Klein | c7d647f | 2020-01-06 12:00:48 -0700 | [diff] [blame] | 74 | handler = ChrootHandler(clear_field) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 75 | chroot = handler.handle(message) |
| 76 | if chroot: |
| 77 | return chroot |
| 78 | |
| 79 | logging.warning('No chroot message found, falling back to defaults.') |
| 80 | return handler.parse_chroot(common_pb2.Chroot()) |
| 81 | |
| 82 | |
Alex Klein | 9b7331e | 2019-12-30 14:37:21 -0700 | [diff] [blame] | 83 | def handle_goma(message, chroot_path): |
| 84 | """Find and parse the GomaConfig field, returning the Goma instance.""" |
| 85 | for descriptor in message.DESCRIPTOR.fields: |
| 86 | field = getattr(message, descriptor.name) |
| 87 | if isinstance(field, common_pb2.GomaConfig): |
| 88 | goma_config = field |
| 89 | return controller_util.ParseGomaConfig(goma_config, chroot_path) |
| 90 | |
| 91 | return None |
| 92 | |
| 93 | |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 94 | class PathHandler(object): |
| 95 | """Handles copying a file or directory into or out of the chroot.""" |
| 96 | |
| 97 | INSIDE = common_pb2.Path.INSIDE |
| 98 | OUTSIDE = common_pb2.Path.OUTSIDE |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 99 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 100 | def __init__(self, field, destination, delete, prefix=None, reset=True): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 101 | """Path handler initialization. |
| 102 | |
| 103 | Args: |
| 104 | field (common_pb2.Path): The Path message. |
| 105 | destination (str): The destination base path. |
| 106 | delete (bool): Whether the copied file(s) should be deleted on cleanup. |
| 107 | prefix (str|None): A path prefix to remove from the destination path |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 108 | when moving files inside the chroot, or to add to the source paths when |
| 109 | moving files out of the chroot. |
| 110 | reset (bool): Whether to reset the state on cleanup. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 111 | """ |
| 112 | assert isinstance(field, common_pb2.Path) |
| 113 | assert field.path |
| 114 | assert field.location |
| 115 | |
| 116 | self.field = field |
| 117 | self.destination = destination |
| 118 | self.prefix = prefix or '' |
| 119 | self.delete = delete |
| 120 | self.tempdir = None |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 121 | self.reset = reset |
| 122 | |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 123 | # For resetting the state. |
| 124 | self._transferred = False |
| 125 | self._original_message = common_pb2.Path() |
| 126 | self._original_message.CopyFrom(self.field) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 127 | |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 128 | def transfer(self, direction): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 129 | """Copy the file or directory to its destination. |
| 130 | |
| 131 | Args: |
| 132 | direction (int): The direction files are being copied (into or out of |
| 133 | the chroot). Specifying the direction allows avoiding performing |
| 134 | unnecessary copies. |
| 135 | """ |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 136 | if self._transferred: |
| 137 | return |
| 138 | |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 139 | assert direction in [self.INSIDE, self.OUTSIDE] |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 140 | |
| 141 | if self.field.location == direction: |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 142 | # Already in the correct location, nothing to do. |
| 143 | return |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 144 | |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 145 | # Create a tempdir for the copied file if we're cleaning it up afterwords. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 146 | if self.delete: |
| 147 | self.tempdir = osutils.TempDir(base_dir=self.destination) |
| 148 | destination = self.tempdir.tempdir |
| 149 | else: |
| 150 | destination = self.destination |
| 151 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 152 | source = self.field.path |
| 153 | if direction == self.OUTSIDE and self.prefix: |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 154 | # When we're extracting files, we need /tmp/result to be |
| 155 | # /path/to/chroot/tmp/result. |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 156 | source = os.path.join(self.prefix, source.lstrip(os.sep)) |
| 157 | |
| 158 | if os.path.isfile(source): |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 159 | # File - use the old file name, just copy it into the destination. |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 160 | dest_path = os.path.join(destination, os.path.basename(source)) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 161 | copy_fn = shutil.copy |
| 162 | else: |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 163 | # Directory - just copy everything into the new location. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 164 | dest_path = destination |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 165 | copy_fn = functools.partial(osutils.CopyDirContents, allow_nonempty=True) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 166 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 167 | logging.debug('Copying %s to %s', source, dest_path) |
| 168 | copy_fn(source, dest_path) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 169 | |
| 170 | # Clean up the destination path for returning, if applicable. |
| 171 | return_path = dest_path |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 172 | if direction == self.INSIDE and return_path.startswith(self.prefix): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 173 | return_path = return_path[len(self.prefix):] |
| 174 | |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 175 | self.field.path = return_path |
| 176 | self.field.location = direction |
| 177 | self._transferred = True |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 178 | |
| 179 | def cleanup(self): |
| 180 | if self.tempdir: |
| 181 | self.tempdir.Cleanup() |
| 182 | self.tempdir = None |
| 183 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 184 | if self.reset: |
| 185 | self.field.CopyFrom(self._original_message) |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 186 | |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 187 | |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 188 | class SyncedDirHandler(object): |
| 189 | """Handler for syncing directories across the chroot boundary.""" |
| 190 | |
| 191 | def __init__(self, field, destination, prefix): |
| 192 | self.field = field |
| 193 | self.prefix = prefix |
| 194 | |
| 195 | self.source = self.field.dir |
| 196 | if not self.source.endswith(os.sep): |
| 197 | self.source += os.sep |
| 198 | |
| 199 | self.destination = destination |
| 200 | if not self.destination.endswith(os.sep): |
| 201 | self.destination += os.sep |
| 202 | |
| 203 | # For resetting the message later. |
| 204 | self._original_message = common_pb2.SyncedDir() |
| 205 | self._original_message.CopyFrom(self.field) |
| 206 | |
| 207 | def _sync(self, src, dest): |
Alex Klein | 915cce9 | 2019-12-17 14:19:50 -0700 | [diff] [blame] | 208 | logging.info('Syncing %s to %s', src, dest) |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 209 | # TODO: This would probably be more efficient with rsync. |
| 210 | osutils.EmptyDir(dest) |
| 211 | osutils.CopyDirContents(src, dest) |
| 212 | |
| 213 | def sync_in(self): |
| 214 | """Sync files from the source directory to the destination directory.""" |
| 215 | self._sync(self.source, self.destination) |
| 216 | self.field.dir = '/%s' % os.path.relpath(self.destination, self.prefix) |
| 217 | |
| 218 | def sync_out(self): |
| 219 | """Sync files from the destination directory to the source directory.""" |
| 220 | self._sync(self.destination, self.source) |
| 221 | self.field.CopyFrom(self._original_message) |
| 222 | |
| 223 | |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 224 | @contextlib.contextmanager |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 225 | def copy_paths_in(message, destination, delete=True, prefix=None): |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 226 | """Context manager function to transfer and cleanup all Path messages. |
| 227 | |
| 228 | Args: |
| 229 | message (Message): A message whose Path messages should be transferred. |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 230 | destination (str): The base destination path. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 231 | delete (bool): Whether the file(s) should be deleted. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 232 | prefix (str|None): A prefix path to remove from the final destination path |
| 233 | in the Path message (i.e. remove the chroot path). |
| 234 | |
| 235 | Returns: |
| 236 | list[PathHandler]: The path handlers. |
| 237 | """ |
| 238 | assert destination |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 239 | |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 240 | handlers = _extract_handlers(message, destination, prefix, delete=delete, |
| 241 | reset=True) |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 242 | |
| 243 | for handler in handlers: |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 244 | handler.transfer(PathHandler.INSIDE) |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 245 | |
| 246 | try: |
| 247 | yield handlers |
| 248 | finally: |
| 249 | for handler in handlers: |
| 250 | handler.cleanup() |
| 251 | |
| 252 | |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 253 | @contextlib.contextmanager |
| 254 | def sync_dirs(message, destination, prefix): |
| 255 | """Context manager function to handle SyncedDir messages. |
| 256 | |
| 257 | The sync semantics are effectively: |
| 258 | rsync -r --del source/ destination/ |
| 259 | * The endpoint runs. * |
| 260 | rsync -r --del destination/ source/ |
| 261 | |
| 262 | Args: |
| 263 | message (Message): A message whose SyncedPath messages should be synced. |
| 264 | destination (str): The destination path. |
| 265 | prefix (str): A prefix path to remove from the final destination path |
| 266 | in the Path message (i.e. remove the chroot path). |
| 267 | |
| 268 | Returns: |
| 269 | list[SyncedDirHandler]: The handlers. |
| 270 | """ |
| 271 | assert destination |
| 272 | |
| 273 | handlers = _extract_handlers(message, destination, prefix=prefix, |
| 274 | delete=False, reset=True, |
| 275 | message_type=common_pb2.SyncedDir) |
| 276 | |
| 277 | for handler in handlers: |
| 278 | handler.sync_in() |
| 279 | |
| 280 | try: |
| 281 | yield handlers |
| 282 | finally: |
| 283 | for handler in handlers: |
| 284 | handler.sync_out() |
| 285 | |
| 286 | |
Alex Klein | aae4977 | 2019-07-26 10:20:50 -0600 | [diff] [blame] | 287 | def extract_results(request_message, response_message, chroot): |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 288 | """Transfer all response Path messages to the request's ResultPath. |
| 289 | |
| 290 | Args: |
| 291 | request_message (Message): The request message containing a ResultPath |
| 292 | message. |
| 293 | response_message (Message): The response message whose Path message(s) |
| 294 | are to be transferred. |
| 295 | chroot (chroot_lib.Chroot): The chroot the files are being copied out of. |
| 296 | """ |
| 297 | # Find the ResultPath. |
| 298 | for descriptor in request_message.DESCRIPTOR.fields: |
| 299 | field = getattr(request_message, descriptor.name) |
| 300 | if isinstance(field, common_pb2.ResultPath): |
| 301 | result_path_message = field |
| 302 | break |
| 303 | else: |
| 304 | # No ResultPath to handle. |
| 305 | return |
| 306 | |
| 307 | destination = result_path_message.path.path |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 308 | handlers = _extract_handlers(response_message, destination, chroot.path, |
| 309 | delete=False, reset=False) |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 310 | |
| 311 | for handler in handlers: |
| 312 | handler.transfer(PathHandler.OUTSIDE) |
| 313 | handler.cleanup() |
| 314 | |
| 315 | |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 316 | def _extract_handlers(message, destination, prefix, delete=False, reset=False, |
| 317 | field_name=None, message_type=None): |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 318 | """Recursive helper for handle_paths to extract Path messages.""" |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 319 | message_type = message_type or common_pb2.Path |
| 320 | is_path_target = message_type is common_pb2.Path |
| 321 | is_synced_target = message_type is common_pb2.SyncedDir |
| 322 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 323 | is_message = isinstance(message, protobuf_message.Message) |
| 324 | is_result_path = isinstance(message, common_pb2.ResultPath) |
| 325 | if not is_message or is_result_path: |
| 326 | # Base case: Nothing to handle. |
| 327 | # There's nothing we can do with scalar values. |
| 328 | # Skip ResultPath instances to avoid unnecessary file copying. |
| 329 | return [] |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 330 | elif is_path_target and isinstance(message, common_pb2.Path): |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 331 | # Base case: Create handler for this message. |
| 332 | if not message.path or not message.location: |
| 333 | logging.debug('Skipping %s; incomplete.', field_name or 'message') |
| 334 | return [] |
| 335 | |
| 336 | handler = PathHandler(message, destination, delete=delete, prefix=prefix, |
| 337 | reset=reset) |
| 338 | return [handler] |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 339 | elif is_synced_target and isinstance(message, common_pb2.SyncedDir): |
| 340 | if not message.dir: |
| 341 | logging.debug('Skipping %s; no directory given.', field_name or 'message') |
| 342 | return [] |
| 343 | |
| 344 | handler = SyncedDirHandler(message, destination, prefix) |
| 345 | return [handler] |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 346 | |
| 347 | # Iterate through each field and recurse. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 348 | handlers = [] |
| 349 | for descriptor in message.DESCRIPTOR.fields: |
| 350 | field = getattr(message, descriptor.name) |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 351 | if field_name: |
| 352 | new_field_name = '%s.%s' % (field_name, descriptor.name) |
| 353 | else: |
| 354 | new_field_name = descriptor.name |
| 355 | |
| 356 | if isinstance(field, protobuf_message.Message): |
| 357 | # Recurse for nested Paths. |
| 358 | handlers.extend( |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 359 | _extract_handlers(field, destination, prefix, delete, reset, |
| 360 | field_name=new_field_name, |
| 361 | message_type=message_type)) |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 362 | else: |
| 363 | # If it's iterable it may be a repeated field, try each element. |
| 364 | try: |
| 365 | iterator = iter(field) |
| 366 | except TypeError: |
| 367 | # Definitely not a repeated field, just move on. |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 368 | continue |
| 369 | |
Alex Klein | bd6edf8 | 2019-07-18 10:30:49 -0600 | [diff] [blame] | 370 | for element in iterator: |
| 371 | handlers.extend( |
Alex Klein | f0717a6 | 2019-12-06 09:45:00 -0700 | [diff] [blame] | 372 | _extract_handlers(element, destination, prefix, delete, reset, |
| 373 | field_name=new_field_name, |
| 374 | message_type=message_type)) |
Alex Klein | c05f3d1 | 2019-05-29 14:16:21 -0600 | [diff] [blame] | 375 | |
Alex Klein | aa70541 | 2019-06-04 15:00:30 -0600 | [diff] [blame] | 376 | return handlers |