Skip to content

Commit

Permalink
resolve $upstream in diagnostics-image-name (see #4171)
Browse files Browse the repository at this point in the history
  • Loading branch information
daprilik committed Jan 22, 2021
1 parent bb2e0a7 commit 61c1abb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion edgelet/edgelet-docker/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub const DEFAULTS: &str = include_str!("../config/unix/default.yaml");
const EDGE_NETWORKID_KEY: &str = "NetworkId";

const UNIX_SCHEME: &str = "unix";
const UPSTREAM_PARENT_KEYWORD: &str = "$upstream";
pub const UPSTREAM_PARENT_KEYWORD: &str = "$upstream";

#[derive(Clone, Debug, serde_derive::Deserialize, serde_derive::Serialize)]
pub struct MobyRuntime {
Expand Down
12 changes: 11 additions & 1 deletion edgelet/iotedge/src/check/checks/well_formed_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ use std::fs::File;

use failure::{self, Fail};

use edgelet_docker::Settings;
use edgelet_core::RuntimeSettings;
use edgelet_docker::{Settings, UPSTREAM_PARENT_KEYWORD};

use crate::check::{checker::Checker, Check, CheckResult};

Expand Down Expand Up @@ -67,6 +68,15 @@ impl WellFormedConfig {
}
};

if let Some(parent_hostname) = settings.parent_hostname() {
if let Some(image_tail) = check
.diagnostics_image_name
.strip_prefix(UPSTREAM_PARENT_KEYWORD)
{
check.diagnostics_image_name = format!("{}{}", parent_hostname, image_tail);
}
}

check.settings = Some(settings);

Ok(CheckResult::Ok)
Expand Down

0 comments on commit 61c1abb

Please sign in to comment.