Skip to content

Commit

Permalink
migrations: add migrations needed to remove ECS settings applier
Browse files Browse the repository at this point in the history
Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
  • Loading branch information
arnaldo2792 committed Mar 27, 2024
1 parent 91c4d96 commit 0b24989
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Release.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "1.19.3"
version = "1.20.0"

[migrations]
"(0.3.1, 0.3.2)" = ["migrate_v0.3.2_admin-container-v0-5-0.lz4"]
Expand Down Expand Up @@ -285,3 +285,8 @@ version = "1.19.3"
"migrate_v1.19.3_corndog-config-file-v0-1-0.lz4",
"migrate_v1.19.3_corndog-services-cfg-v0-1-0.lz4",
]
"(1.19.3, 1.20.0)" = [
"migrate_v1.20.0_remove-ecs-settings-applier.lz4",
"migrate_v1.20.0_update-ecs-config-path.lz4",
"migrate_v1.20.0_update-ecs-config-template-path.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.3"
release-version = "1.20.0"

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

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

3 changes: 3 additions & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ members = [
"api/migration/migrations/v1.19.3/host-containers-config-list-v0-1-0",
"api/migration/migrations/v1.19.3/corndog-config-file-v0-1-0",
"api/migration/migrations/v1.19.3/corndog-services-cfg-v0-1-0",
"api/migration/migrations/v1.20.0/remove-ecs-settings-applier",
"api/migration/migrations/v1.20.0/update-ecs-config-path",
"api/migration/migrations/v1.20.0/update-ecs-config-template-path",

"bloodhound",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "remove-ecs-settings-applier"
version = "0.1.0"
edition = "2021"
authors = ["Arnaldo Garcia <[email protected]>"]
license = "Apache-2.0 OR MIT"
publish = false
exclude = ["README.md"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

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

/// We updated the 'affected-services' list metadata for 'settings.ecs' to remove
/// ecs-settings-applier on upgrade, and to add it on downgrade.
fn run() -> Result<()> {
migrate(ReplaceListsMigration(vec![ListReplacement {
setting: "services.ecs.restart-commands",
old_vals: &[
"/usr/bin/ecs-settings-applier",
"/bin/systemctl try-reload-or-restart ecs.service",
],
new_vals: &["/bin/systemctl try-reload-or-restart ecs.service"],
}]))
}

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,13 @@
[package]
name = "update-ecs-config-path"
version = "0.1.0"
edition = "2021"
authors = ["Arnaldo Garcia <[email protected]>"]
license = "Apache-2.0 OR MIT"
publish = false
exclude = ["README.md"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[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::ReplaceStringMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We updated the 'path' string for 'ecs-config'
fn run() -> Result<()> {
migrate(ReplaceStringMigration {
setting: "configuration-files.ecs-config.path",
old_val: "/etc/ecs/ecs.config",
new_val: "/etc/systemd/system/ecs.service.d/10-base.conf",
})
}

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,13 @@
[package]
name = "update-ecs-config-template-path"
version = "0.1.0"
edition = "2021"
authors = ["Arnaldo Garcia <[email protected]>"]
license = "Apache-2.0 OR MIT"
publish = false
exclude = ["README.md"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[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::ReplaceStringMigration;
use migration_helpers::{migrate, Result};
use std::process;

/// We updated the 'template-path' for 'ecs-config'
fn run() -> Result<()> {
migrate(ReplaceStringMigration {
setting: "configuration-files.ecs-config.template-path",
old_val: "/usr/share/templates/ecs.config",
new_val: "/usr/share/templates/ecs-base-conf",
})
}

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

0 comments on commit 0b24989

Please sign in to comment.