docker start only launches the entrypoint and returns immediately, so a
startup script or `airflow db migrate` failing partway through never
surfaced anywhere: the readiness poller only checked isReady() and had no
path back to a failure status, so the environment reported CREATING
forever instead of CREATE_FAILED.
MwaaEnvironmentManager.hasAirflowContainerExited inspects the container's
running state (docker-removed counts as exited too), and the readiness
poller (extracted into checkReadiness for direct testability) now marks
CREATE_FAILED when isReady() is false and the container has exited.
Two things this needed to stay safe under concurrency and partial
failure, both of which isReady() already handles and this had to match:
- isReady()/hasAirflowContainerExited() are blocking Docker/HTTP calls,
wide enough for a concurrent DeleteEnvironment (which sets DELETING on
the same Environment instance before tearing down its containers) to
have moved the environment past CREATING in the meantime. checkReadiness
re-checks the status immediately before writing, in both branches, so it
can't resurrect a just-deleted environment into storage with a status
decided from stale, pre-delete information.
- hasAirflowContainerExited only treats NotFoundException (the container
is actually gone) as exited; any other Docker error is inconclusive and
must not propagate, since the readiness poller shares one loop across
every CREATING environment and an uncaught exception from one
environment's check would otherwise skip every other environment for
that poll tick, the same failure mode isReady()'s own catch-all already
avoids.
Fixes#3437