Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 349f7c5

Browse files
committed
Merge branch 'unmanaged_nodes/machine_identity' into rewrite/unmanaged_node
2 parents d066ff9 + f36dd9d commit 349f7c5

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

src/agent/onefuzz-agent/src/agent.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft Corporation.
22
// Licensed under the MIT License.
33

4+
#![allow(clippy::too_many_arguments)]
45
use anyhow::{Error, Result};
56
use tokio::time;
67

src/agent/onefuzz-agent/src/agent/tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ impl Fixture {
3535
work_queue,
3636
worker_runner,
3737
None,
38+
true,
3839
)
3940
}
4041

src/agent/onefuzz-agent/src/commands.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,6 @@ pub async fn add_ssh_key(key_info: &SshKeyInfo) -> Result<()> {
155155

156156
#[cfg(target_family = "unix")]
157157
pub async fn add_ssh_key(key_info: &SshKeyInfo) -> Result<()> {
158-
if get_scaleset_name().await?.is_none() {
159-
warn!("adding ssh keys only supported on managed nodes");
160-
return Ok(());
161-
}
162-
163158
let user =
164159
get_user_by_name(ONEFUZZ_SERVICE_USER).ok_or_else(|| format_err!("unable to find user"))?;
165160
info!("adding ssh key:{:?} to user:{:?}", key_info, user);

src/agent/onefuzz/examples/test-input.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::path::PathBuf;
55

66
use anyhow::Result;
7-
use onefuzz::input_tester::Tester;
7+
use onefuzz::{input_tester::Tester, machine_id::MachineIdentity};
88
use structopt::StructOpt;
99

1010
#[derive(Debug, PartialEq, Eq, StructOpt)]
@@ -53,7 +53,13 @@ async fn main() -> Result<()> {
5353
}
5454

5555
let env = Default::default();
56-
let tester = Tester::new(&setup_dir, &opt.exe, &target_options, &env);
56+
let tester = Tester::new(
57+
&setup_dir,
58+
&opt.exe,
59+
&target_options,
60+
&env,
61+
MachineIdentity::default(),
62+
);
5763

5864
let check_debugger = !opt.no_check_debugger;
5965
let tester = tester

src/agent/onefuzz/src/expand.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,11 @@ mod tests {
520520
#[tokio::test]
521521
async fn test_expand_machine_id() -> Result<()> {
522522
let machine_id = Uuid::new_v4();
523-
let expand = Expand::new(&MachineIdentity {
524-
machine_id: machine_id,
523+
let machine_identity = MachineIdentity {
524+
machine_id,
525525
..Default::default()
526-
})
527-
.machine_id()
528-
.await?;
526+
};
527+
let expand = Expand::new(&machine_identity).machine_id().await?;
529528
let expanded = expand.evaluate_value("{machine_id}")?;
530529
// Check that "{machine_id}" expands to a valid UUID, but don't worry about the actual value.
531530
let expanded_machine_id = Uuid::parse_str(&expanded)?;

src/agent/onefuzz/src/libfuzzer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ mod tests {
445445
options.clone(),
446446
env.clone(),
447447
&temp_setup_dir.path(),
448+
MachineIdentity::default(),
448449
);
449450

450451
// verify catching bad exits with -help=1
@@ -473,6 +474,7 @@ mod tests {
473474
options.clone(),
474475
env.clone(),
475476
&temp_setup_dir.path(),
477+
MachineIdentity::default(),
476478
);
477479
// verify good exits with -help=1
478480
assert!(

src/agent/onefuzz/src/machine_id.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ const VM_NAME_URL: &str =
2828
const VM_SCALESET_NAME: &str =
2929
"http://169.254.169.254/metadata/instance/compute/vmScaleSetName?api-version=2020-06-01&format=text";
3030

31-
const COMPUTE_METADATA_URL: &str =
32-
"http://169.254.169.254/metadata/instance/compute?api-version=2020-06-01";
33-
3431
impl MachineIdentity {
3532
pub async fn from_metadata() -> Result<Self> {
3633
let machine_id = Self::get_machine_id().await?;

src/deny.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ ignore = [
1919
"RUSTSEC-2021-0139", # ansi_term is unmaintained
2020
"RUSTSEC-2021-0145", # atty bug: we are unaffected (no custom allocator)
2121
]
22-
]
2322

2423
[bans]
2524

0 commit comments

Comments
 (0)