Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow migrating of whitelisted config.json fields #72

Merged
merged 5 commits into from
Nov 23, 2023

Conversation

cywang117
Copy link
Contributor

@cywang117 cywang117 commented Aug 21, 2023

This also includes os-config querying /os/v2/config instead, which has a different response format. The changes to the response format are reflected in the updated tests, and the API PR for the change in the backend is linked (and should be merged and tested first). The linked meta-balena PR should be merged with both the schema and os-config binary change.

See: https://balena.fibery.io/Work/Improvement/os-config-improving-the-interface-for-config.json-modification-901
See: balena-os/meta-balena#3227
See: balena-io/open-balena-api#1394
Signed-off-by: Christina Ying Wang [email protected]
Change-type: minor

@cywang117 cywang117 force-pushed the cywang117/os-config-v2 branch from fdfbf94 to 2402ba5 Compare August 24, 2023 02:43
@cywang117 cywang117 marked this pull request as ready for review August 24, 2023 02:43
@flowzone-app flowzone-app bot enabled auto-merge August 24, 2023 02:44
@cywang117 cywang117 changed the title WIP: Update os-config to allow migrating of whitelisted config.json fields Update os-config to allow migrating of whitelisted config.json fields Aug 24, 2023
@cywang117 cywang117 changed the title Update os-config to allow migrating of whitelisted config.json fields Allow migrating of whitelisted config.json fields Aug 24, 2023
@cywang117 cywang117 force-pushed the cywang117/os-config-v2 branch 4 times, most recently from 4258fa4 to 964c1c2 Compare August 24, 2023 18:51
src/join.rs Outdated Show resolved Hide resolved
src/migrate.rs Outdated Show resolved Hide resolved
src/migrate.rs Outdated Show resolved Hide resolved
src/migrate.rs Outdated Show resolved Hide resolved
@cywang117 cywang117 force-pushed the cywang117/os-config-v2 branch 2 times, most recently from 321bd25 to 861cd08 Compare August 28, 2023 21:17
@cywang117 cywang117 requested a review from majorz August 28, 2023 21:18
@cywang117
Copy link
Contributor Author

cywang117 commented Aug 28, 2023

@majorz Thanks for reviewing! I've applied the requested changes in 861cd08 , and also applied the suggestion you had from Zulip chat about separating the update and delete functionalities in migrate.rs into separate methods.

@cywang117 cywang117 force-pushed the cywang117/os-config-v2 branch from 206117c to c2f39af Compare September 4, 2023 23:19
@cywang117 cywang117 force-pushed the cywang117/os-config-v2 branch from 446cb1c to 7124ebe Compare September 13, 2023 21:41
The response from querying /os/v1/config has changed slightly,
the changes to the response are reflected in the updated tests
in this commit.

See: https://balena.fibery.io/Work/Improvement/os-config-improving-the-interface-for-config.json-modification-901
See: balena-os/meta-balena#3227
See: balena-io/open-balena-api#1394
Signed-off-by: Christina Ying Wang <[email protected]>
Change-type: minor
@cywang117 cywang117 force-pushed the cywang117/os-config-v2 branch from 7124ebe to bb29ca0 Compare September 13, 2023 23:05
* Renamed `generate_config_json_migration` to `migrate_config_json`

* Introduced a `OverridesMap` type alias for `HashMap<String, serde_json::Value>`

* Renamed a `to_update` function argument to `overrides` to match the remote
config instructions name.

* Renamed `handle_update_directives` to `handle_override_directives` in
a similar fashion.

* `handle_override_directives` modifies `config_json` in-place instead
of operating on top of a clone. It returns a `bool` now to indicate
whether modifications were made. All this simplifies a bit the external
logic as well.

* Processing of `overrides` keys is now done in sorted order, so that
logging always produces the same output when the arguments of
`handle_override_directives` are the same. This helps with test code as
some of it operates on top of logging output.

* Inside the `migrate_config_json` integration tests I switched the output
checks to use the `.stdout(output)` pattern used in other tests as it
provides a diff output when something fails and is easier to navigate when
error occurs.

Signed-off-by: Zahari Petkov <[email protected]>
Signed-off-by: Zahari Petkov <[email protected]>
@majorz
Copy link
Contributor

majorz commented Nov 23, 2023

lgtm

@flowzone-app flowzone-app bot merged commit b9d3ad5 into master Nov 23, 2023
52 checks passed
@flowzone-app flowzone-app bot deleted the cywang117/os-config-v2 branch November 23, 2023 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants