Skip to content

Commit

Permalink
migrations: add add-shibaken migration
Browse files Browse the repository at this point in the history
Adds a new migration for shibaken setting-generator
  • Loading branch information
jpculp committed Feb 24, 2021
1 parent a7d71ab commit 8095c02
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ version = "1.0.5"
"migrate_v1.0.5_add-user-data.lz4",
"migrate_v1.0.5_add-network-settings.lz4",
"migrate_v1.0.5_add-proxy-restart.lz4",
"migrate_v1.0.5_add-proxy-services.lz4"
"migrate_v1.0.5_add-proxy-services.lz4",
]
"(1.0.5, 1.0.6)" = [
"migrate_v1.0.6_metricdog-init.lz4",
"migrate_v1.0.6_add-static-pods.lz4",
"migrate_v1.0.6_kubelet-standalone-tls-settings.lz4",
"migrate_v1.0.6_kubelet-standalone-tls-services.lz4",
"migrate_v1.0.6_control-container-v0-4-2.lz4"
"migrate_v1.0.6_control-container-v0-4-2.lz4",
"migrate_v1.0.6_add-shibaken.lz4",
]

7 changes: 7 additions & 0 deletions sources/Cargo.lock

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

1 change: 1 addition & 0 deletions sources/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ members = [
"api/migration/migrations/v1.0.6/kubelet-standalone-tls-settings",
"api/migration/migrations/v1.0.6/kubelet-standalone-tls-services",
"api/migration/migrations/v1.0.6/control-container-v0-4-2",
"api/migration/migrations/v1.0.6/add-shibaken",

"bottlerocket-release",

Expand Down
12 changes: 12 additions & 0 deletions sources/api/migration/migrations/v1.0.6/add-shibaken/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "add-shibaken"
version = "0.1.0"
authors = ["Patrick J.P. Culp <jpculp@amazon.com>"]
license = "Apache-2.0 OR MIT"
edition = "2018"
publish = false
# Don't rebuild crate just because of changes to README.
exclude = ["README.md"]

[dependencies]
migration-helpers = { path = "../../../migration-helpers" }
23 changes: 23 additions & 0 deletions sources/api/migration/migrations/v1.0.6/add-shibaken/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#![deny(rust_2018_idioms)]

use migration_helpers::common_migrations::{AddMetadataMigration, SettingMetadata};
use migration_helpers::{migrate, Result};
use std::process;

/// We added a new setting metadata, `host-containers.admin.user-data.setting-generator`
fn run() -> Result<()> {
migrate(AddMetadataMigration(&[SettingMetadata {
metadata: &["setting-generator"],
setting: "settings.host-containers.admin.user-data",
}]))
}

// Returning a Result from main makes it print a Debug representation of the error, but with Snafu
// we have nice Display representations of the error, so we wrap "main" (run) and print any error.
// https://github.com/shepmaster/snafu/issues/110
fn main() {
if let Err(e) = run() {
eprintln!("{}", e);
process::exit(1);
}
}

0 comments on commit 8095c02

Please sign in to comment.