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 15, 2024
1 parent ff545e4 commit 176c883
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,6 @@ version = "1.19.2"
"(1.19.1, 1.19.2)" = [
"migrate_v1.19.2_certdog-config-file-v0-1-0.lz4",
"migrate_v1.19.2_certdog-service-cfg-v0-1-0.lz4",
"migrate_v1.19.2_host-containers-config-file-v0-1-0.lz4",
"migrate_v1.19.2_host-containers-config-list-v0-1-0.lz4",
]
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 @@ -63,6 +63,8 @@ members = [
"api/migration/migrations/v1.19.1/public-control-container-v0-7-8",
"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/host-containers-config-file-v0-1-0",
"api/migration/migrations/v1.19.2/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 176c883

Please sign in to comment.