-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrations: add migration to remove ECS settings applier
Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
- Loading branch information
1 parent
4f2b0d1
commit bd1d34c
Showing
6 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
13 changes: 13 additions & 0 deletions
13
sources/api/migration/migrations/v1.20.0/remove-ecs-settings-applier/Cargo.toml
This file contains 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
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" } |
23 changes: 23 additions & 0 deletions
23
sources/api/migration/migrations/v1.20.0/remove-ecs-settings-applier/src/main.rs
This file contains 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
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); | ||
} | ||
} |