Skip to content

Commit

Permalink
fix where lists were not logged
Browse files Browse the repository at this point in the history
Signed-off-by: Berend Sliedrecht <[email protected]>
  • Loading branch information
berendsliedrecht committed Nov 21, 2023
1 parent b9efed3 commit a064933
Show file tree
Hide file tree
Showing 10 changed files with 54 additions and 82 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ permissions:
contents: read

env:
RUST_VERSION: "1.65.0"
RUST_VERSION: "1.70.0"

on:
pull_request:
Expand Down
72 changes: 20 additions & 52 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions crates/afj-rest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ readme.workspace = true
[dependencies]
siera-agent = { path = "../agent", version = "0.*" }
siera-logger = { path = "../logger", version = "0.*" }
async-trait = "0.1.51"
reqwest = { version = "0.11", features = ["json"] }
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.68"
async-trait = "0.1.74"
reqwest = { version = "0.11.22", features = ["json"] }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
6 changes: 3 additions & 3 deletions crates/agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ license.workspace = true
readme.workspace = true

[dependencies]
async-trait = "0.1.51"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.68"
async-trait = "0.1.74"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
4 changes: 2 additions & 2 deletions crates/automations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ readme.workspace = true
siera-cloudagent-python = { path = "../cloudagent-python", version = "0.*" }
siera-logger = { path = "../logger", version = "0.*" }
siera-agent = { path = "../agent", version = "0.*" }
colored = "2.0.0"
async-trait = "0.1.51"
colored = "2.0.4"
async-trait = "0.1.74"
rand = "0.8.5"
16 changes: 8 additions & 8 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ siera-automations = { path = "../automations", version = "0.*" }
siera-afj-rest = { path = "../afj-rest", version = "0.*" }
siera-cloudagent-python = { path = "../cloudagent-python", version = "0.*" }
siera-logger = { path = "../logger", version = "0.*" }
base64 = "0.13.0"
clap = { version = "4.2.5", features = ["derive"] }
colored = "2.0.0"
qr2term = "0.2.2"
serde = { version = "1.0.130", features = ["derive"] }
serde_json = "1.0.68"
serde_yaml = "0.8.23"
tokio = { version = "1", features = ["full"] }
base64 = "0.21.5"
clap = { version = "4.4.8", features = ["derive"] }
colored = "2.0.4"
qr2term = "0.3.1"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_yaml = "0.9.27"
tokio = { version = "1.34.0", features = ["rt-multi-thread"] }
10 changes: 6 additions & 4 deletions crates/cli/src/modules/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::error::{Error, Result};
use crate::help_strings::HelpStrings;
use crate::utils::loader::{Loader, LoaderVariant};
use crate::utils::qr::print_qr_code;
use base64::{engine::general_purpose, Engine as _};
use clap::{Args, Subcommand};
use siera_agent::modules::connection::{
ConnectionCreateInvitationOptions, ConnectionGetAllOptions, ConnectionModule,
Expand Down Expand Up @@ -116,8 +117,8 @@ pub async fn parse_connection_args(
};
agent.create_invitation(options).await.map(|response| {
loader.stop();
info!({ "message": "Created invititation"});
log!({ "connection_id": response.id});
info!({ "message": "Created invititation" });
log!({ "connection_id": response.id });

Check warning on line 121 in crates/cli/src/modules/connection.rs

View check run for this annotation

Codecov / codecov/patch

crates/cli/src/modules/connection.rs#L120-L121

Added lines #L120 - L121 were not covered by tests
if *qr {
info!({"message": "Scan this QR code to accept the invitation"});
print_qr_code(&response.invitation_url).unwrap();
Expand Down Expand Up @@ -199,8 +200,9 @@ pub fn invite_url_to_struct(url: impl AsRef<str>) -> Result<ConnectionReceiveInv
.ok_or(Error::InvalidAgentInvitation)?;

// Base64 decode the invitation to a Vec<u8>
let decoded =
base64::decode(serialized_invitation).map_err(|_| Error::InvalidAgentInvitation)?;
let decoded = general_purpose::STANDARD
.decode(serialized_invitation)
.map_err(|_| Error::InvalidAgentInvitation)?;

Check warning on line 205 in crates/cli/src/modules/connection.rs

View check run for this annotation

Codecov / codecov/patch

crates/cli/src/modules/connection.rs#L203-L205

Added lines #L203 - L205 were not covered by tests

// Convert the vec to a valid string
let decoded_str = str::from_utf8(&decoded)?;
Expand Down
6 changes: 4 additions & 2 deletions crates/cli/src/modules/oob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::error::{Error, Result};
use crate::help_strings::HelpStrings;
use crate::utils::loader::{Loader, LoaderVariant};
use crate::utils::qr::print_qr_code;
use base64::{engine::general_purpose, Engine as _};
use clap::{Args, Subcommand};
use siera_agent::modules::oob::{
OobConnectionCreateInvitationOptions, OobConnectionReceiveInvitationOptions, OobModule,
Expand Down Expand Up @@ -126,8 +127,9 @@ pub fn invite_url_to_struct(url: impl AsRef<str>) -> Result<OobConnectionReceive
.ok_or(Error::InvalidAgentInvitation)?;

// Base64 decode the invitation to a Vec<u8>
let decoded =
base64::decode(serialized_invitation).map_err(|_| Error::InvalidAgentInvitation)?;
let decoded = general_purpose::STANDARD
.decode(serialized_invitation)
.map_err(|_| Error::InvalidAgentInvitation)?;

Check warning on line 132 in crates/cli/src/modules/oob.rs

View check run for this annotation

Codecov / codecov/patch

crates/cli/src/modules/oob.rs#L130-L132

Added lines #L130 - L132 were not covered by tests

// Convert the vec to a valid string
let decoded_str = str::from_utf8(&decoded)?;
Expand Down
8 changes: 4 additions & 4 deletions crates/logger/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ readme.workspace = true

[dependencies]
cli-clipboard = "0.4.0"
xcb = "1.2.0"
serde = { version = "1.0.130", features = ["derive"] }
colored = "2.0.4"
lazy_static = "1.4.0"
serde_json = "1.0.68"
colored = "2.0.0"
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
xcb = "1.2.2"
4 changes: 2 additions & 2 deletions crates/logger/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ macro_rules! internal_log {
let values = o.values();
for value in values {
let s = match value {
$crate::serde_json::Value::Object(o) => {
if let Some(value) = $crate::serde_json::to_string_pretty(value).ok() {
$crate::serde_json::Value::Object(_) | $crate::serde_json::Value::Array(_) => {
if let Ok(value) = $crate::serde_json::to_string_pretty(value) {
if $level == ::siera_logger::LogLevel::None {
value.to_owned()
} else {
Expand Down

0 comments on commit a064933

Please sign in to comment.