ES check handle no shards, fail on none 404 status for appsettings default, #975
This commit is contained in:
parent
a82e4b1c51
commit
37a6922718
|
|
@ -99,7 +99,12 @@ class Command(BaseCommand):
|
|||
continue
|
||||
|
||||
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)
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(" ✓ ES connection established")
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class Command(BaseCommand):
|
|||
def _init_app_config(self) -> None:
|
||||
"""init default app config to ES"""
|
||||
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]:
|
||||
self.stdout.write(
|
||||
self.style.SUCCESS(" skip completed appsettings init")
|
||||
|
|
@ -276,6 +276,13 @@ class Command(BaseCommand):
|
|||
|
||||
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)
|
||||
_, status_code = handler.sync_defaults()
|
||||
self.stdout.write(
|
||||
|
|
|
|||
Loading…
Reference in New Issue