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

Fix cc kbc aa param config file parsing #368

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/aa_cc_kbc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ on:
paths:
- 'attestation-agent/kbc/cc_kbc/**'
- 'attestation-agent/kbs_protocol/**'
- 'attestation-agent/lib/**'
- '.github/workflows/aa_cc_kbc.yml'
pull_request:
paths:
- 'attestation-agent/kbc/cc_kbc/**'
- 'attestation-agent/kbs_protocol/**'
- 'attestation-agent/lib/**'
- '.github/workflows/aa_cc_kbc.yml'
create:
workflow_dispatch:
Expand Down
8 changes: 5 additions & 3 deletions attestation-agent/lib/src/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// SPDX-License-Identifier: Apache-2.0
//

use anyhow::{anyhow, Context, Result};
use anyhow::{anyhow, Result};
use kbs_protocol::{evidence_provider::NativeEvidenceProvider, KbsClientBuilder};
use serde::{Deserialize, Serialize};
use std::path::Path;
use tokio::fs;

const PEER_POD_CONFIG_PATH: &str = "/peerpod/daemon.json";
Expand Down Expand Up @@ -66,10 +67,11 @@ pub(crate) async fn get_kbs_host_from_config_file() -> Result<String> {

// Hard-code agent config path to "/etc/agent-config.toml" as a workaround
let agent_config_str = fs::read_to_string("/etc/agent-config.toml")
.context("Failed to read /etc/agent-config.toml file")?;
.await
.map_err(|e| anyhow!("Failed to read /etc/agent-config.toml file: {e}"))?;

let agent_config: AgentConfig = toml::from_str(&agent_config_str)
.context("Failed to deserialize /etc/agent-config.toml")?;
.map_err(|e| anyhow!("Failed to deserialize /etc/agent-config.toml: {e}"))?;

agent_config.aa_kbc_params.ok_or(anyhow!(
"no `aa_kbc_params` found in /etc/agent-config.toml!",
Expand Down