-
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 migrations needed to remove ECS settings applier
Signed-off-by: Arnaldo Garcia Rincon <[email protected]>
- Loading branch information
1 parent
05b6448
commit ea39589
Showing
9 changed files
with
127 additions
and
0 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
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); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
sources/api/migration/migrations/v1.20.0/update-ecs-config-path/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 = "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" } |
19 changes: 19 additions & 0 deletions
19
sources/api/migration/migrations/v1.20.0/update-ecs-config-path/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,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); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
sources/api/migration/migrations/v1.20.0/update-ecs-config-template-path/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 = "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" } |
19 changes: 19 additions & 0 deletions
19
sources/api/migration/migrations/v1.20.0/update-ecs-config-template-path/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,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); | ||
} | ||
} |