fix(cli): honour --endpoint and AWS_ENDPOINT_URL, and make status work again - #173
Merged
Merged
Conversation
The CLI commands set os.environ["AWS_ENDPOINT_URL"] after backend.config had already read and deleted it, so nothing in StackPort saw the value. get_client() then fell through to the saved default in ~/.stackport/endpoints.json, and --endpoint / AWS_ENDPOINT_URL were ignored on any machine that had opened the web UI once. Resolve the endpoint once per command (explicit flag or env var wins, otherwise the saved default) and hand it to get_client and _probe_service explicitly. This also fixes `stackport status`, which called _probe_service without its required endpoint_url and exited 2 with "missing 1 required positional argument". Fixes #171
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #171
Problem
stackport list,describeandstatustake--endpointand honourAWS_ENDPOINT_URL, but only on a machine that never opened the web UI. Once~/.stackport/endpoints.jsonexists, the saved default wins and both are ignored.On top of that,
stackport statushas been failing for everyone: it called_probe_service(svc)without theendpoint_urlthat helper requires, and exited 2 with "missing 1 required positional argument".Cause
The commands wrote
os.environ["AWS_ENDPOINT_URL"]afterbackend.confighad already read and deleted that variable, so nothing in StackPort read it.get_client()with noendpoint_urlresolves through the endpoint store, which loads the saved file. The fresh-machine cases only worked because botocore picks the variable up on its own.Fix
--endpoint(orAWS_ENDPOINT_URLat startup) wins, otherwise the saved default, the same one the web UI usesget_clientand_probe_servicereceiveendpoint_urlandregionexplicitlyos.environwrites are goneVerified
Against my own
~/.stackport(saved defaultlocal= 4566), with nothing listening on 4599 so the error shows the URL called:AWS_ENDPOINT_URL=...:4599, fresh data dirAWS_ENDPOINT_URL=...:4599, existing~/.stackport--endpoint ...:4599, fresh data dir--endpoint ...:4599, existing~/.stackport~/.stackportstackport status --endpoint http://localhost:4566against MiniStack: 35 services, 35 available.Four new tests pin the behaviour: flag reaches
get_clientforlistanddescribe, no flag falls back to the saved default, andstatusprobes every service at the given endpoint. Full backend suite: 544 passed.