Skip to content

Commit

Permalink
static-pods: add migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
jmt-lab committed Apr 18, 2024
1 parent 6ed54fa commit cf7a4e6
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -297,4 +297,6 @@ version = "1.20.0"
"migrate_v1.20.0_update-ecs-config-path.lz4",
"migrate_v1.20.0_update-ecs-config-template-path.lz4",
"migrate_v1.20.0_add-ntp-default-options-v0-1-0.lz4",
"migrate_v1.20.0_static-pods-add-prefix-v0-1-0.lz4",
"migrate_v1.20.0_static-pods-services-cfg-v0-1-0.lz4",
]
5 changes: 5 additions & 0 deletions packages/static-pods/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ edition = "2021"
publish = false
build = "../build.rs"

[package.metadata.build-package]
source-groups = [
"api/static-pods"
]

[lib]
path = "../packages.rs"

Expand Down
2 changes: 1 addition & 1 deletion packages/static-pods/static-pods.spec
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ install -p -m 0644 %{S:0} %{buildroot}%{_cross_templatedir}

%files
%{_cross_bindir}/static-pods
%{_cross_templatedir}/static-pods-toml
%{_cross_templatedir}/static-pods-toml
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 @@ -80,6 +80,8 @@ members = [
"api/migration/migrations/v1.20.0/update-ecs-config-path",
"api/migration/migrations/v1.20.0/update-ecs-config-template-path",
"api/migration/migrations/v1.20.0/add-ntp-default-options-v0-1-0",
"api/migration/migrations/v1.20.0/static-pods-add-prefix-v0-1-0",
"api/migration/migrations/v1.20.0/static-pods-services-cfg-v0-1-0",

"bloodhound",

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "static-pods-add-prefix-v0-1-0"
version = "0.1.0"
authors = ["Jarrett Tierney <[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,16 @@
use migration_helpers::common_migrations::AddPrefixesMigration;
use migration_helpers::{migrate, Result};
use std::process;

fn run() -> Result<()> {
migrate(AddPrefixesMigration(vec![
"configuration-files.static-pods-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 = "static-pods-services-cfg-v0-1-0"
version = "0.1.0"
authors = ["Jarrett Tierney <[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,18 @@
use migration_helpers::common_migrations::{ListReplacement, ReplaceListsMigration};
use migration_helpers::{migrate, Result};
use std::process;

fn run() -> Result<()> {
migrate(ReplaceListsMigration(vec![ListReplacement {
setting: "services.static-pods.configuration-files",
old_vals: &[],
new_vals: &["static-pods-toml"],
}]))
}

fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}
2 changes: 1 addition & 1 deletion sources/api/static-pods/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude = ["README.md"]
base64 = "0.21"
log = "0.4"
modeled-types = { path = "../../models/modeled-types", version = "0.1" }
serde = { version = "1.0", features = ["default"]}
serde = { version = "1", features = ["default"]}
simplelog = "0.12"
snafu = "0.8"
toml = "0.8"
Expand Down

0 comments on commit cf7a4e6

Please sign in to comment.