karton-core 5.6.0__py3-none-any.whl → 5.6.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- __version__ = "5.6.0"
1
+ __version__ = "5.6.1"
karton/core/backend.py CHANGED
@@ -1021,21 +1021,31 @@ class KartonBackend:
1021
1021
  self.s3.delete_objects(Bucket=bucket, Delete={"Objects": delete_objects})
1022
1022
 
1023
1023
  def remove_object_versions(
1024
- self, bucket: str, object_versions: Dict[str, List[str]]
1024
+ self,
1025
+ bucket: str,
1026
+ object_versions: Dict[str, List[str]],
1027
+ explicit_version_null: bool = False,
1025
1028
  ) -> None:
1026
1029
  """
1027
1030
  Bulk remove resource object versions from object storage
1028
1031
 
1029
1032
  :param bucket: Bucket name
1030
1033
  :param object_versions: Object version identifiers
1034
+ :param explicit_version_null: |
1035
+ Some S3 providers (e.g. MinIO) need a reference
1036
+ to "null" version explicitly when versioning is in suspended state. On the
1037
+ other hand, some providers refuse to delete "null" versions when bucket
1038
+ versioning is disabled.
1039
+ See also: https://github.com/CERT-Polska/karton/issues/273.
1031
1040
  """
1032
- versions = iter(
1033
- (uid, version_id)
1034
- for uid, versions in object_versions.items()
1035
- for version_id in versions
1036
- )
1037
1041
  deletion_chunks = chunks(
1038
- [{"Key": uid, "VersionId": version_id} for uid, version_id in versions],
1042
+ [
1043
+ {"Key": uid, "VersionId": version_id}
1044
+ if version_id != "null" or explicit_version_null
1045
+ else {"Key": uid}
1046
+ for uid, versions in object_versions.items()
1047
+ for version_id in versions
1048
+ ],
1039
1049
  100,
1040
1050
  )
1041
1051
  for delete_objects in deletion_chunks:
karton/system/system.py CHANGED
@@ -49,6 +49,9 @@ class SystemService(KartonServiceBase):
49
49
  self.crash_started_tasks_on_timeout = self.config.getboolean(
50
50
  "system", "crash_started_tasks_on_timeout", False
51
51
  )
52
+ self.enable_null_version_deletion = self.config.getboolean(
53
+ "system", "enable_null_version_deletion", False
54
+ )
52
55
 
53
56
  self.last_gc_trigger = time.time()
54
57
 
@@ -61,6 +64,7 @@ class SystemService(KartonServiceBase):
61
64
  " task_crashed_timeout:\t%s\n"
62
65
  " enable_gc:\t%s\n"
63
66
  " enable_router:\t%s\n"
67
+ " enable_null_version_deletion:\t%s\n"
64
68
  " crash_started_tasks_on_timeout:\t%s",
65
69
  self.gc_interval,
66
70
  self.task_dispatched_timeout,
@@ -68,6 +72,7 @@ class SystemService(KartonServiceBase):
68
72
  self.task_crashed_timeout,
69
73
  self.enable_gc,
70
74
  self.enable_router,
75
+ self.enable_null_version_deletion,
71
76
  self.crash_started_tasks_on_timeout,
72
77
  )
73
78
 
@@ -88,7 +93,11 @@ class SystemService(KartonServiceBase):
88
93
  del resources_to_remove[resource.uid]
89
94
  # Remove unreferenced resources
90
95
  if resources_to_remove:
91
- self.backend.remove_object_versions(karton_bucket, resources_to_remove)
96
+ self.backend.remove_object_versions(
97
+ karton_bucket,
98
+ resources_to_remove,
99
+ explicit_version_null=self.enable_null_version_deletion,
100
+ )
92
101
 
93
102
  def gc_collect_tasks(self) -> None:
94
103
  self.log.debug("GC: gc_collect_tasks started")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: karton-core
3
- Version: 5.6.0
3
+ Version: 5.6.1
4
4
  Summary: Distributed malware analysis orchestration framework
5
5
  Home-page: https://github.com/CERT-Polska/karton
6
6
  Classifier: Programming Language :: Python :: 3
@@ -1,7 +1,7 @@
1
- karton_core-5.6.0-nspkg.pth,sha256=vHa-jm6pBTeInFrmnsHMg9AOeD88czzQy-6QCFbpRcM,539
1
+ karton_core-5.6.1-nspkg.pth,sha256=vHa-jm6pBTeInFrmnsHMg9AOeD88czzQy-6QCFbpRcM,539
2
2
  karton/core/__init__.py,sha256=QuT0BWZyp799eY90tK3H1OD2hwuusqMJq8vQwpB3kG4,337
3
- karton/core/__version__.py,sha256=9eGec3AYz2CNznnfEwKYRiJ65G9gDWtXmb587ljDycg,22
4
- karton/core/backend.py,sha256=HlAolngYUTx2ajXhLf5RbWxmPOq5orLfz52iTkNxxqM,38147
3
+ karton/core/__version__.py,sha256=-q9tSF5ofTJum4PMjvbhaE1xmTXehc_9rxMGcmfodcw,22
4
+ karton/core/backend.py,sha256=g0BSQBsFAksRd_VY5QDjBJ8yIIyzAmwxy-kfJgAZ_lo,38628
5
5
  karton/core/base.py,sha256=C6Lco3E0XCsxvEjeVOLR9fxh_IWJ1vjC9BqUYsQyewE,8083
6
6
  karton/core/config.py,sha256=7oKchitq6pWzPuXRfjBXqVT_BgGIz2p-CDo1RGaNJQg,8118
7
7
  karton/core/exceptions.py,sha256=8i9WVzi4PinNlX10Cb-lQQC35Hl-JB5R_UKXa9AUKoQ,153
@@ -17,11 +17,11 @@ karton/core/test.py,sha256=tms-YM7sUKQDHN0vm2_W7DIvHnO_ld_VPsWHnsbKSfk,9102
17
17
  karton/core/utils.py,sha256=sEVqGdVPyYswWuVn8wYXBQmln8Az826N_2HgC__pmW8,4090
18
18
  karton/system/__init__.py,sha256=JF51OqRU_Y4c0unOulvmv1KzSHSq4ZpXU8ZsH4nefRM,63
19
19
  karton/system/__main__.py,sha256=QJkwIlSwaPRdzwKlNmCAL41HtDAa73db9MZKWmOfxGM,56
20
- karton/system/system.py,sha256=v2rEJYN2Vq5-hH8yUGFv6r2ZdX-TOQg0ldsEC2T6qO8,16315
21
- karton_core-5.6.0.dist-info/LICENSE,sha256=o8h7hYhn7BJC_-DmrfqWwLjaR_Gbe0TZOOQJuN2ca3I,1519
22
- karton_core-5.6.0.dist-info/METADATA,sha256=Atu4wfGAqbkw-lVDV_Wtt3fxSG7nV0QmVqjGnfNAFZ4,6818
23
- karton_core-5.6.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
24
- karton_core-5.6.0.dist-info/entry_points.txt,sha256=OgLlsXy61GP6-Yob3oXqeJ2hlRU6LBLj33fr0NufKz0,98
25
- karton_core-5.6.0.dist-info/namespace_packages.txt,sha256=X8SslCPsqXDCnGZqrYYolzT3xPzJMq1r-ZQSc0jfAEA,7
26
- karton_core-5.6.0.dist-info/top_level.txt,sha256=X8SslCPsqXDCnGZqrYYolzT3xPzJMq1r-ZQSc0jfAEA,7
27
- karton_core-5.6.0.dist-info/RECORD,,
20
+ karton/system/system.py,sha256=cFE4hCS0LWnwdCiIjU0ym8dHujE5ORi4REJR_y5b2gA,16671
21
+ karton_core-5.6.1.dist-info/LICENSE,sha256=o8h7hYhn7BJC_-DmrfqWwLjaR_Gbe0TZOOQJuN2ca3I,1519
22
+ karton_core-5.6.1.dist-info/METADATA,sha256=AJoa9O_0SOYI3IuVHXhwB6lXoUSs7S4nU6QM8_xHxVI,6818
23
+ karton_core-5.6.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
24
+ karton_core-5.6.1.dist-info/entry_points.txt,sha256=OgLlsXy61GP6-Yob3oXqeJ2hlRU6LBLj33fr0NufKz0,98
25
+ karton_core-5.6.1.dist-info/namespace_packages.txt,sha256=X8SslCPsqXDCnGZqrYYolzT3xPzJMq1r-ZQSc0jfAEA,7
26
+ karton_core-5.6.1.dist-info/top_level.txt,sha256=X8SslCPsqXDCnGZqrYYolzT3xPzJMq1r-ZQSc0jfAEA,7
27
+ karton_core-5.6.1.dist-info/RECORD,,