Skip to content

Commit

Permalink
migrations: migrate host-containers to use config file
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Berning <[email protected]>
  • Loading branch information
sam-berning committed Feb 28, 2024
1 parent 650292e commit 3346ec3
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.19.2"
version = "1.19.3"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -275,3 +275,7 @@ version = "1.19.2"
"migrate_v1.19.2_certdog-service-cfg-v0-1-0.lz4",
"migrate_v1.19.2_add-ecs-enable-container-metadata.lz4",
]
"(1.19.2, 1.19.3)" = [
"migrate_v1.19.3_host-containers-config-file-v0-1-0.lz4",
"migrate_v1.19.3_host-containers-config-list-v0-1-0.lz4",
]
2 changes: 1 addition & 1 deletion Twoliter.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
schema-version = 1
release-version = "1.19.2"
release-version = "1.19.3"

[sdk]
registry = "public.ecr.aws/bottlerocket"
Expand Down
14 changes: 14 additions & 0 deletions sources/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ members = [
"api/migration/migrations/v1.19.2/certdog-config-file-v0-1-0",
"api/migration/migrations/v1.19.2/certdog-service-cfg-v0-1-0",
"api/migration/migrations/v1.19.2/add-ecs-enable-container-metadata",
"api/migration/migrations/v1.19.3/host-containers-config-file-v0-1-0",
"api/migration/migrations/v1.19.3/host-containers-config-list-v0-1-0",

"bloodhound",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "host-containers-config-file-v0-1-0"
version = "0.1.0"
authors = ["Sam Berning <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use migration_helpers::common_migrations::AddPrefixesMigration;
use migration_helpers::{migrate, Result};
use std::process;

// Create the new config file
fn run() -> Result<()> {
migrate(AddPrefixesMigration(vec![
"configuration-files.host-containers-toml",
]))
}

fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "host-containers-config-list-v0-1-0"
version = "0.1.0"
authors = ["Sam Berning <[email protected]>"]
license = "Apache-2.0 OR MIT"
edition = "2021"
publish = false
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers", version = "0.1.0" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use migration_helpers::common_migrations::{ListReplacement, ReplaceListsMigration};
use migration_helpers::{migrate, Result};
use std::process;

// Add new config file to host-containers
fn run() -> Result<()> {
migrate(ReplaceListsMigration(vec![ListReplacement {
setting: "service.host-containers.configuration-files",
old_vals: &["host-ctr-toml"],
new_vals: &["host-ctr-toml", "host-containers-toml"],
}]))
}

fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}

0 comments on commit 3346ec3

Please sign in to comment.