Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #23951: Fix some small things in rudder-package #5282

Draft
wants to merge 1 commit into
base: branches/rudder/8.1
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 18 additions & 5 deletions relay/sources/rudder-package/src/repository.rs
Expand Up @@ -20,7 +20,7 @@ use crate::{
config::{Configuration, Credentials},
signature::{SignatureVerifier, VerificationSuccess},
webapp::Webapp,
LICENSES_FOLDER, REPOSITORY_INDEX_PATH,
CONFIG_PATH, LICENSES_FOLDER, REPOSITORY_INDEX_PATH,
};

static APP_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
Expand Down Expand Up @@ -79,11 +79,24 @@ impl Repository {
let res = req.send()?;

// Special error messages for common errors
let error_conf_msg = format!("Please check your configuration in {}", CONFIG_PATH);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might not be CONFIG_PATH depending on the CLI parameter.

match res.status() {
StatusCode::UNAUTHORIZED => bail!("Received an HTTP 401 Unauthorized error when trying to get {}. Please check your credentials in the configuration.", path),
StatusCode::FORBIDDEN => bail!("Received an HTTP 403 Forbidden error when trying to get {}. Please check your credentials in the configuration.", path),
StatusCode::NOT_FOUND => bail!("Received an HTTP 404 Not found error when trying to get {}. Please check your configuration.", path),
_ => ()
StatusCode::UNAUTHORIZED => bail!(
"Received an HTTP 401 Unauthorized error when trying to get {}. {}.",
path,
error_conf_msg
),
StatusCode::FORBIDDEN => bail!(
"Received an HTTP 403 Forbidden error when trying to get {}. {}.",
path,
error_conf_msg
),
StatusCode::NOT_FOUND => bail!(
"Received an HTTP 404 Not found error when trying to get {}. {}.",
path,
error_conf_msg
),
_ => (),
}

Ok(res.error_for_status()?)
Expand Down