Parse lines from sources files
(self, line)
| 372 | return pieces |
| 373 | |
| 374 | def parse(self, line): |
| 375 | """ |
| 376 | Parse lines from sources files |
| 377 | """ |
| 378 | self.disabled, self.invalid, self.comment, repo_line = _invalid(line) |
| 379 | if self.invalid: |
| 380 | return False |
| 381 | if repo_line[1].startswith("["): |
| 382 | repo_line = [x for x in (line.strip("[]") for line in repo_line) if x] |
| 383 | opts = _get_opts(self.line) |
| 384 | if "arch" in opts: |
| 385 | self.architectures.extend(opts["arch"]["value"]) |
| 386 | if "signedby" in opts: |
| 387 | self.signedby = opts["signedby"]["value"] |
| 388 | if "trusted" in opts: |
| 389 | self.trusted = opts["trusted"]["value"] |
| 390 | for opt in opts.values(): |
| 391 | opt = opt["full"] |
| 392 | if opt: |
| 393 | try: |
| 394 | repo_line.pop(repo_line.index(opt)) |
| 395 | except ValueError: |
| 396 | repo_line.pop(repo_line.index(f"[{opt}]")) |
| 397 | if len(repo_line) < 3: |
| 398 | raise SaltInvocationError( |
| 399 | f"Invalid repository definition: {' '.join(repo_line)}" |
| 400 | ) |
| 401 | self.type = repo_line[0] |
| 402 | self.uri = repo_line[1] |
| 403 | self.dist = repo_line[2] |
| 404 | self.comps = repo_line[3:] |
| 405 | return True |
| 406 | |
| 407 | def __str__(self): |
| 408 | """ |
no test coverage detected