Skip to content

Commit

Permalink
fix: add error visibiliy on cert parsing path
Browse files Browse the repository at this point in the history
  • Loading branch information
digikata committed Jan 31, 2024
1 parent b29fb11 commit 3c3cd68
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ members = [
resolver = "2"

[workspace.dependencies]
anyhow = "1.0.38"
anyhow = "1.0"
fluvio-future = "0.6"
serde_yaml = { version = "0.9.0", default-features = false }
4 changes: 2 additions & 2 deletions src/k8-client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
edition = "2021"
name = "k8-client"
version = "12.0.0"
version = "12.0.1"
authors = ["Fluvio Contributors <team@fluvio.io>"]
description = "Core Kubernetes metadata traits"
repository = "https://github.com/infinyon/k8-api"
Expand Down Expand Up @@ -39,7 +39,7 @@ serde_qs = "0.12.0"
serde_yaml = { workspace = true, optional = true }
async-trait = "0.1.52"
fluvio-future = { workspace = true, features=["net", "task"] }
k8-metadata-client = { version="7.0.0", path="../k8-metadata-client" }
k8-metadata-client = { version="7.0.0", path="../k8-metadata-client" }
k8-diff = { version="0.1.0", path="../k8-diff" }
k8-config = { version="2.2.0", path="../k8-config" }
k8-types = { version="0.8.5", path="../k8-types", features=["core", "batch"] }
Expand Down
16 changes: 13 additions & 3 deletions src/k8-client/src/cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::ErrorKind;
use std::path::Path;

use anyhow::Result;
use tracing::debug;
use tracing::{debug,info};

use k8_config::K8Config;
use k8_config::KubeConfig;
Expand Down Expand Up @@ -179,14 +179,24 @@ where

let token_output = Command::new(exec.command.clone())
.args(exec.args.clone())
.output()?;
.output()
.map_err(|e| {
let msg = format!("executing {} {:#?}", exec.command, exec.args);
info!(target: "k8_client", "error {msg}");
e
})?;

debug!(
cmd_token = ?String::from_utf8_lossy(&token_output.stdout).to_string()
);

let credential: K8Obj<ExecCredentialSpec> =
serde_json::from_slice(&token_output.stdout)?;
serde_json::from_slice(&token_output.stdout)
.map_err(|e| {
let msg = format!("parsing reply from: {} {:#?}", exec.command, exec.args);
info!(target: "k8_client", "error {msg}");
e
})?;
let token = credential.status.token;
debug!(?token);
Ok((builder, Some(token)))
Expand Down

0 comments on commit 3c3cd68

Please sign in to comment.