[#207] Fix shards for disabled write_cache
Some checks reported warnings
DCO action / DCO (pull_request) Has been cancelled

Signed-off-by: a.berezin <a.berezin@yadro.com>
This commit is contained in:
Andrey Berezin 2024-04-15 16:50:54 +03:00
parent a85070e957
commit 70f0357960

View file

@ -56,9 +56,7 @@ class Shard:
var_prefix = f"{SHARD_PREFIX}{shard_id}"
blobstor_count = Shard._get_blobstor_count_from_section(config_object, shard_id)
blobstors = [
Blobstor.from_config_object(config_object, shard_id, blobstor_id) for blobstor_id in range(blobstor_count)
]
blobstors = [Blobstor.from_config_object(config_object, shard_id, blobstor_id) for blobstor_id in range(blobstor_count)]
write_cache_enabled = config_object.as_bool(f"{var_prefix}_WRITECACHE_ENABLED")
@ -71,7 +69,13 @@ class Shard:
@staticmethod
def from_object(shard):
metabase = shard["metabase"]["path"] if "path" in shard["metabase"] else shard["metabase"]
writecache_enabled = True
if "enabled" in shard["writecache"]:
writecache_enabled = shard["writecache"]["enabled"]
writecache = shard["writecache"]["path"] if "path" in shard["writecache"] else shard["writecache"]
if not writecache_enabled:
writecache = ""
# Currently due to issue we need to check if pilorama exists in keys
# TODO: make pilorama mandatory after fix