Fix prompting for missing infrastructure values - #1202
Merged
Conversation
ellismg
force-pushed
the
ellismg/parameters-file-in-memory
branch
3 times, most recently
from
November 23, 2022 01:21
41d2fbf to
ff4562b
Compare
ellismg
force-pushed
the
ellismg/parameters-file-in-memory
branch
from
November 23, 2022 01:36
ff4562b to
7a506db
Compare
vhvb1989
approved these changes
Nov 23, 2022
Our logic to prompt the user for missing infrastructure values was broken because we did not tell the spinner we wanted to interact with the user, so the spinner would prevent the prompt UI from being shown. The logic we had for trying to save these values was totally broken and in practice would end up generating files that the ARM control plane would reject. We now save these values in the newly added `Config` object on the environment, using `infra.prameters.<parameterName>` as the key name. As part of this work, we no longer materialize the full `.parameters.json` file to disk, we no longer need to do this now that we are using the SDK directly. Fixes Azure#1176 Fixes Azure#1191
ellismg
force-pushed
the
ellismg/parameters-file-in-memory
branch
from
November 24, 2022 02:06
7a506db to
694212e
Compare
ellismg
marked this pull request as ready for review
November 24, 2022 02:21
ellismg
requested review from
hemarina,
jongio,
wbreza and
weikanglim
as code owners
November 24, 2022 02:21
Collaborator
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsStandalone Binary
Container |
ellismg
added a commit
to ellismg/azure-dev
that referenced
this pull request
Nov 29, 2022
In Azure#1202 we added a `config.json` file in the environment, which we use to persist configured values for required infrastructure parameters which are not set in `.parameters.json` files. As part of that logic, we made it so that the constructor of the environment would validate that a `config.json` file was present in the environment and if not, fail (similar to the check it already did for the .env file). This worked for new environments, since `.Save()` will always write an empty `config.json` file. But for existing environments, the read of the config.json would fail, with ErrNotExists, which would be wrapped up and returned to the caller. The caller would use the ErrNotExists to mean "the environment doesn't exist" and so it would prompt the user to see if they wanted to create it. Rework the constructor such that we return ErrNotExists when the directory for the environment doesn't exist, instead of using the existence of the `.env` file to mean anything and add some unit tests for these cases.
ellismg
added a commit
that referenced
this pull request
Nov 29, 2022
In #1202 we added a `config.json` file in the environment, which we use to persist configured values for required infrastructure parameters which are not set in `.parameters.json` files. As part of that logic, we made it so that the constructor of the environment would validate that a `config.json` file was present in the environment and if not, fail (similar to the check it already did for the .env file). This worked for new environments, since `.Save()` will always write an empty `config.json` file. But for existing environments, the read of the config.json would fail, with ErrNotExists, which would be wrapped up and returned to the caller. The caller would use the ErrNotExists to mean "the environment doesn't exist" and so it would prompt the user to see if they wanted to create it. Rework the constructor such that we return ErrNotExists when the directory for the environment doesn't exist, instead of using the existence of the `.env` file to mean anything and add some unit tests for these cases.
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.
Our logic to prompt the user for missing infrastructure values was
broken because we did not tell the spinner we wanted to interact with
the user, so the spinner would prevent the prompt UI from being shown.
The logic we had for trying to save these values was totally broken
and in practice would end up generating files that the ARM control
plane would reject.
We now save these values in the newly added
Configobject on theenvironment, using
infra.prameters.<parameterName>as the key name.As part of this work, we no longer materialize the full
.parameters.jsonfile to disk, we no longer need to do this now thatwe are using the SDK directly.
Fixes #1176
Fixes #1191