Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Match functionality to function name"
Browse files Browse the repository at this point in the history
This reverts commit b5540ad.
schneems committed Sep 11, 2023
1 parent acf3fc8 commit c61dd9b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions buildpacks/ruby/src/layers/metrics_agent_install.rs
Original file line number Diff line number Diff line change
@@ -82,8 +82,8 @@ impl Layer for MetricsAgentInstall {
let bin_dir = layer_path.join("bin");

let mut timer = self.section.say_with_inline_timer("Downloading");
let agentmon = install_agentmon(&bin_dir).map_err(RubyBuildpackError::MetricsAgentError)?;

let agentmon =
agentmon_download(&bin_dir).map_err(RubyBuildpackError::MetricsAgentError)?;
timer.done();

self.section.say("Writing scripts");
@@ -196,14 +196,13 @@ fn write_execd_script(
Ok(execd)
}

fn install_agentmon(dir: &Path) -> Result<PathBuf, MetricsAgentInstallError> {
let agentmon = download_untar(DOWNLOAD_URL, &dir).map(|_| dir.join("agentmon"))?;
fn agentmon_download(dir: &Path) -> Result<PathBuf, MetricsAgentInstallError> {
download_to_dir(DOWNLOAD_URL, dir)?;

chmod_plus_x(&agentmon).map_err(MetricsAgentInstallError::PermissionError)?;
Ok(agentmon)
Ok(dir.join("agentmon"))
}

fn download_untar(
fn download_to_dir(
url: impl AsRef<str>,
destination: &Path,
) -> Result<(), MetricsAgentInstallError> {
@@ -214,6 +213,9 @@ fn download_untar(

untar(agentmon_tgz.path(), destination)?;

chmod_plus_x(&destination.join("agentmon"))
.map_err(MetricsAgentInstallError::PermissionError)?;

Ok(())
}

0 comments on commit c61dd9b

Please sign in to comment.