in sources/api/migration/migrations/v1.5.3/vmware-host-containers/src/main.rs [19:88]
fn forward(&mut self, mut input: MigrationData) -> Result<MigrationData> {
// For admin container
if let Some(data) = input.data.get_mut(ADMIN_CONTAINER_SOURCE_SETTING_NAME) {
match data {
serde_json::Value::String(source) => {
for ver in PREVIOUS_ADMIN_CONTAINER_VERSIONS {
let prev_source = format!("{}:{}", ADMIN_CONTAINER_IMAGE_REPOSITORY, ver);
if *source == prev_source {
*source = format!(
"{}:{}",
ADMIN_CONTAINER_IMAGE_REPOSITORY, TARGET_ADMIN_CONTAINER_VERSION
);
println!(
"Changed value of '{}' from '{}' to '{}' on upgrade",
ADMIN_CONTAINER_SOURCE_SETTING_NAME, prev_source, source
);
break;
}
}
}
_ => {
println!(
"'{}' is set to non-string value '{}'",
ADMIN_CONTAINER_SOURCE_SETTING_NAME, data
);
}
}
} else {
println!(
"Found no '{}' to change on upgrade",
ADMIN_CONTAINER_SOURCE_SETTING_NAME
);
}
// For control container
if let Some(data) = input.data.get_mut(CONTROL_CONTAINER_SOURCE_SETTING_NAME) {
match data {
serde_json::Value::String(source) => {
for ver in PREVIOUS_CONTROL_CONTAINER_VERSIONS {
let prev_source = format!("{}:{}", CONTROL_CONTAINER_IMAGE_REPOSITORY, ver);
if *source == prev_source {
*source = format!(
"{}:{}",
CONTROL_CONTAINER_IMAGE_REPOSITORY,
TARGET_CONTROL_CONTAINER_VERSION
);
println!(
"Changed value of '{}' from '{}' to '{}' on upgrade",
CONTROL_CONTAINER_SOURCE_SETTING_NAME, prev_source, source
);
break;
}
}
}
_ => {
println!(
"'{}' is set to non-string value '{}'",
CONTROL_CONTAINER_SOURCE_SETTING_NAME, data
);
}
}
} else {
println!(
"Found no '{}' to change on upgrade",
CONTROL_CONTAINER_SOURCE_SETTING_NAME
);
}
Ok(input)
}