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 #24401: rudder-pkg don't inform that credential are not set up #5536

Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Test-Audit {
function Technique-Test-Audit {
[CmdletBinding()]
param (
[parameter(Mandatory = $true)]
Expand Down Expand Up @@ -296,4 +296,4 @@


EndTechniqueCall -Name $techniqueName
}
}
7 changes: 6 additions & 1 deletion relay/sources/rudder-package/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@ pub fn run_inner(args: Args) -> Result<()> {
let mut webapp = Webapp::new(PathBuf::from(WEBAPP_XML_PATH), webapp_version);
let mut db = Database::read(Path::new(PACKAGES_DATABASE_PATH))?;

create_dir_all(TMP_PLUGINS_FOLDER).context("Create temporary directory")?;
create_dir_all(TMP_PLUGINS_FOLDER).with_context(|| {
format!(
"Failed to create temporary directory in '{}'",
TMP_PLUGINS_FOLDER
)
})?;

match args.command {
Command::Install { force, package } => {
Expand Down
4 changes: 4 additions & 0 deletions relay/sources/rudder-package/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use anyhow::Result;
use chrono::Utc;
use cli_table::format::{HorizontalLine, Separator, VerticalLine};
use serde::Serialize;
use tracing::warn;

use crate::{
cli::Format,
Expand Down Expand Up @@ -131,6 +132,9 @@ impl ListOutput {
.flat_map(|j| db.plugin_provides_jar(&j))
.map(|p| p.metadata.name.clone())
.collect();
if index.is_none() {
warn!("No repository index found. Try to update it using 'rudder package update'")
}
let latest = index.map(|i| i.latest_compatible_plugins(&webapp.version));

for p in db.plugins.values() {
Expand Down
5 changes: 3 additions & 2 deletions relay/sources/rudder-package/src/versions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use core::fmt;
use std::{cmp::Ordering, fmt::Display, fs, str::FromStr};

use anyhow::{bail, Error, Result};
use anyhow::{bail, Context, Error, Result};
use regex::Regex;
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
use tracing::debug;
Expand Down Expand Up @@ -130,7 +130,8 @@ impl RudderVersion {
}

pub fn from_path(path: &str) -> Result<Self, Error> {
let content = fs::read_to_string(path)?;
let content = fs::read_to_string(path)
.with_context(|| format!("Failed to read the Rudder version file '{}'", path))?;
let re = Regex::new(r"rudder_version=(?<raw_rudder_version>.*)")?;
let caps = match re.captures(&content) {
None => bail!(
Expand Down
9 changes: 7 additions & 2 deletions relay/sources/rudder-package/src/webapp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{
process::Command,
};

use anyhow::Result;
use anyhow::{Context, Result};
use quick_xml::{
events::{BytesEnd, BytesStart, BytesText, Event},
reader::Reader,
Expand Down Expand Up @@ -38,7 +38,12 @@ impl Webapp {

/// Return currently loaded jars
pub fn jars(&self) -> Result<Vec<String>> {
let mut reader = Reader::from_file(&self.path)?;
let mut reader = Reader::from_file(&self.path).with_context(|| {
format!(
"Failed to read from webapp config file '{}'",
&self.path.to_string_lossy()
)
})?;
let mut buf = Vec::new();
let mut in_extra_classpath = false;

Expand Down