mirror of
https://git.vectorsigma.ru/public/tubearchivist.git
synced 2026-08-04 21:39:49 +00:00
ES check handle no shards, fail on none 404 status for appsettings default, #975
This commit is contained in:
@@ -99,7 +99,12 @@ class Command(BaseCommand):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if status_code and status_code == 200:
|
if status_code and status_code == 200:
|
||||||
path = "_cluster/health?wait_for_status=yellow&timeout=60s"
|
path = (
|
||||||
|
"_cluster/health?"
|
||||||
|
"wait_for_status=yellow&"
|
||||||
|
"timeout=60s&"
|
||||||
|
"wait_for_active_shards=1"
|
||||||
|
)
|
||||||
_, _ = ElasticWrap(path).get(timeout=60)
|
_, _ = ElasticWrap(path).get(timeout=60)
|
||||||
self.stdout.write(
|
self.stdout.write(
|
||||||
self.style.SUCCESS(" ✓ ES connection established")
|
self.style.SUCCESS(" ✓ ES connection established")
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class Command(BaseCommand):
|
|||||||
def _init_app_config(self) -> None:
|
def _init_app_config(self) -> None:
|
||||||
"""init default app config to ES"""
|
"""init default app config to ES"""
|
||||||
self.stdout.write("[10] Check AppConfig")
|
self.stdout.write("[10] Check AppConfig")
|
||||||
_, status_code = ElasticWrap("ta_config/_doc/appsettings").get()
|
response, status_code = ElasticWrap("ta_config/_doc/appsettings").get()
|
||||||
if status_code in [200, 201]:
|
if status_code in [200, 201]:
|
||||||
self.stdout.write(
|
self.stdout.write(
|
||||||
self.style.SUCCESS(" skip completed appsettings init")
|
self.style.SUCCESS(" skip completed appsettings init")
|
||||||
@@ -276,6 +276,13 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if status_code != 404:
|
||||||
|
message = " 🗙 ta_config index lookup failed"
|
||||||
|
self.stdout.write(self.style.ERROR(message))
|
||||||
|
self.stdout.write(response)
|
||||||
|
sleep(60)
|
||||||
|
raise CommandError(message)
|
||||||
|
|
||||||
handler = AppConfig.__new__(AppConfig)
|
handler = AppConfig.__new__(AppConfig)
|
||||||
_, status_code = handler.sync_defaults()
|
_, status_code = handler.sync_defaults()
|
||||||
self.stdout.write(
|
self.stdout.write(
|
||||||
|
|||||||
Reference in New Issue
Block a user