quickfix for config "validate" interfering with rebasing logic#218
Closed
aldenh-viam wants to merge 1 commit intoviamrobotics:mainfrom
Closed
quickfix for config "validate" interfering with rebasing logic#218aldenh-viam wants to merge 1 commit intoviamrobotics:mainfrom
aldenh-viam wants to merge 1 commit intoviamrobotics:mainfrom
Conversation
7b3db95 to
f1a5620
Compare
f1a5620 to
ce83e2b
Compare
ce83e2b to
d2a5b31
Compare
Member
|
ya lets revert #177 instead |
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.
Extremely extremely gross quickfix for the issue with #177 reported on Slack. Might be better as a starting point for a bigger redisign rather than merging as-is.
It was reported that when re-entering provisioning after we have already been online at some point in the past, some specified values in
viam_defaults.jsonlikeHotspotPrefixaren't being used. This is because:validateConfigthat runs after we retrieve config from cloud and enforces that some values (likeHotspotPrefix) must be present:agent/utils/config.go
Line 438 in 400235e
If not, it substitutes in the hardcoded default:
agent/utils/config.go
Line 22 in 400235e
This makes it difficult to "rebase" the config on the fly, like I attempted to do before (because we can't tell which values actually came from user and which are defaults that
validateConfigsubbed in).Remember: we want
DefaultConfig+CloudConfigfor regular use, but exchange it forDefaultConfig+viam_defaults.json+CloudConfigjust before entering provisioning.The simplest solution I could come up with, implemented here, is to go through each value of the rebased config, and if it matches the hardcoded
DefaultConfig, replace it with the value from theDefaultConfig+viam_defaults.jsonconfig (i.e. its value either comes fromviam_defaultsif specified there, otherwise DefaultConfig). This unfortunately also means if the user has specified that option in the cloud cfg and its value happens to match the DefaultConfig's, viam_defaults's will still be prioritized.Another solution is to store the two configs separately.... unfortunately that probably means another
config_cache.jsonon disk.