|
26 | 26 | from urllib.parse import urlparse |
27 | 27 |
|
28 | 28 | from compliance.config import get_config |
29 | | -from compliance.evidence import TmpEvidence, get_evidence_class |
| 29 | +from compliance.evidence import CONTENT_FLAGS, TmpEvidence, get_evidence_class |
30 | 30 | from compliance.utils.data_parse import ( |
31 | 31 | format_json, get_sha256_hash, parse_dot_key |
32 | 32 | ) |
@@ -302,6 +302,9 @@ def index(self, evidence, checks=None, evidence_used=None): |
302 | 302 | repo_files.append(self.get_file(evidence.path)) |
303 | 303 | if tombstones: |
304 | 304 | metadata[evidence.name]['tombstones'] = tombstones |
| 305 | + for content_flag in CONTENT_FLAGS: |
| 306 | + if getattr(evidence, content_flag, False): |
| 307 | + metadata[evidence.name][content_flag] = True |
305 | 308 | if checks is not None: |
306 | 309 | metadata[evidence.name]['checks'] = checks |
307 | 310 | if evidence_used is not None: |
@@ -575,16 +578,20 @@ def get_locker_repo(self, locker='evidence locker'): |
575 | 578 | ) |
576 | 579 | kwargs = {'branch': self.branch} |
577 | 580 | shallow_days = get_config().get('locker.shallow_days', -1) |
| 581 | + addl_msg = None |
578 | 582 | if shallow_days >= 0: |
579 | 583 | since_dt = dt.utcnow() - timedelta(days=shallow_days + 1) |
580 | 584 | since = since_dt.strftime('%Y/%m/%d') |
581 | 585 | kwargs['shallow_since'] = since |
582 | | - self.logger.info( |
583 | | - f'{locker.title()} contains commits since {since}...' |
584 | | - ) |
| 586 | + addl_msg = f'{locker.title()} contains commits since {since}' |
| 587 | + start = time.perf_counter() |
585 | 588 | self.repo = git.Repo.clone_from( |
586 | 589 | self.repo_url_with_creds, self.local_path, **kwargs |
587 | 590 | ) |
| 591 | + duration = time.perf_counter() - start |
| 592 | + self.logger.info(f'{locker.title()} cloned in {duration:.3f}s') |
| 593 | + if addl_msg: |
| 594 | + self.logger.info(addl_msg) |
588 | 595 |
|
589 | 596 | def init_config(self): |
590 | 597 | """Apply the git configuration.""" |
@@ -815,7 +822,9 @@ def _get_evidence(self, evidence_path, ignore_ttl=False, evidence_dt=None): |
815 | 822 | partition={ |
816 | 823 | 'fields': metadata.get('partition_fields'), |
817 | 824 | 'root': metadata.get('partition_root') |
818 | | - } |
| 825 | + }, |
| 826 | + binary_content=metadata.get('binary_content', False), |
| 827 | + filtered_content=metadata.get('filtered_content', False) |
819 | 828 | ) |
820 | 829 | except TypeError: |
821 | 830 | ev_dt_str = (evidence_dt or dt.utcnow()).strftime('%Y-%m-%d') |
|
0 commit comments