feat: M4 seed — upload & publish 20 rule sets, fix config/schema column names
- Fix _export_settings for pydantic v2 compatibility (model_fields) - Fix delete_time→deleted_at, update_time→updated_at in RuleServiceImpl - Add OssClient.EnsureBucket method - Replace contract_lease/sale/tech rules.yaml from new-rules - Seed script: batch upload 20 rule YAMLs to OSS + write DB + publish - Config: fix OSS import chain
This commit is contained in:
@@ -144,6 +144,18 @@ class OssClient:
|
||||
TempFile.write(Content)
|
||||
return TempFile.name
|
||||
|
||||
def EnsureBucket(self, Bucket: str | None = None) -> str:
|
||||
"""确保 bucket 存在,不存在则创建。返回 bucket 名。"""
|
||||
TargetBucket = Bucket or self.bucket
|
||||
Client = self._GetMinioClient()
|
||||
from minio import Minio
|
||||
try:
|
||||
if not Client.bucket_exists(TargetBucket):
|
||||
Client.make_bucket(TargetBucket)
|
||||
except Minio.S3Error:
|
||||
pass
|
||||
return TargetBucket
|
||||
|
||||
def ObjectExists(self, Source: str, Bucket: str | None = None) -> bool:
|
||||
"""判断对象是否存在。"""
|
||||
Ref = self.ResolveObjectRef(Source=Source, Bucket=Bucket)
|
||||
|
||||
Reference in New Issue
Block a user