Skip to content

Commit

Permalink
fix: Extract value, not the json path
Browse files Browse the repository at this point in the history
Signed-off-by: Bryant Biggs <[email protected]>
  • Loading branch information
bryantbiggs committed Nov 11, 2024
1 parent a31fcd6 commit 42569f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
4 changes: 1 addition & 3 deletions examples/dynamic_jsonpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ async fn main() -> anyhow::Result<()> {
// Use the given JSONPATH to filter the ObjectList
let list_json = serde_json::to_value(&list)?;
for res in jsonpath.find_slice(&list_json) {
if let Some(path) = res.to_path() {
info!("\t\t: {path}");
}
info!("\t\t {}", res.to_data());
}
Ok(())
}
9 changes: 1 addition & 8 deletions kube-client/src/client/auth/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,14 +516,7 @@ fn extract_value(json: &serde_json::Value, context: &str, path: &str) -> Result<
)));
};

if let Some(val) = res.clone().to_path() {
Ok(val.to_owned())
} else {
Err(Error::AuthExec(format!(
"Target {:?} value {:?} is not a string: {:?}",
context, path, res
)))
}
Ok(res.to_data().to_string())
}

/// ExecCredentials is used by exec-based plugins to communicate credentials to
Expand Down

0 comments on commit 42569f4

Please sign in to comment.