Skip to content

Commit

Permalink
Fix build issues
Browse files Browse the repository at this point in the history
Created using spr 1.3.4
  • Loading branch information
sunshowers committed Nov 6, 2023
2 parents 1f3e925 + 5b50777 commit 9510f2a
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 69 deletions.
20 changes: 10 additions & 10 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ ipnetwork = { version = "0.20", features = ["schemars"] }
itertools = "0.11.0"
key-manager = { path = "key-manager" }
lazy_static = "1.4.0"
libc = "0.2.149"
libc = "0.2.150"
linear-map = "1.2.0"
macaddr = { version = "1.0.1", features = ["serde_std"] }
mime_guess = "2.0.4"
Expand Down Expand Up @@ -369,21 +369,21 @@ tokio-util = "0.7.10"
toml = "0.8.6"
toml_edit = "0.20.7"
topological-sort = "0.2.2"
tough = { version = "0.12", features = [ "http" ] }
tough = { version = "0.14", features = [ "http" ] }
trybuild = "1.0.85"
tufaceous = { path = "tufaceous" }
tufaceous-lib = { path = "tufaceous-lib" }
unicode-width = "0.1.11"
update-engine = { path = "update-engine" }
usdt = "0.3"
uuid = { version = "1.4.1", features = ["serde", "v4"] }
uuid = { version = "1.5.0", features = ["serde", "v4"] }
walkdir = "2.4"
wicket = { path = "wicket" }
wicket-common = { path = "wicket-common" }
wicketd-client = { path = "clients/wicketd-client" }
zeroize = { version = "1.6.0", features = ["zeroize_derive", "std"] }
zip = { version = "0.6.6", default-features = false, features = ["deflate","bzip2"] }
zone = { version = "0.2", default-features = false, features = ["async"] }
zone = { version = "0.3", default-features = false, features = ["async"] }

[profile.dev]
panic = "abort"
Expand Down
3 changes: 1 addition & 2 deletions nexus/src/app/background/inventory_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ mod test {
let resolver = internal_dns::resolver::Resolver::new_from_addrs(
cptestctx.logctx.log.clone(),
&[cptestctx.internal_dns.dns_server.local_address()],
)
.unwrap();
);

// Now we'll create our own copy of the background task and activate it
// a bunch and make sure that it always creates a new collection and
Expand Down
9 changes: 3 additions & 6 deletions nexus/tests/integration_tests/certificates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,9 @@ async fn test_silo_certificates() {
// Log into silo1 (the Silo created during rack initialization) as the user
// that was created when that Silo was created. We'll use this session to
// create the other Silos and their users.
let resolver = Arc::new(
CustomDnsResolver::new(
cptestctx.external_dns.dns_server.local_address(),
)
.unwrap(),
);
let resolver = Arc::new(CustomDnsResolver::new(
cptestctx.external_dns.dns_server.local_address(),
));
let session_token = oxide_client::login(
silo1.reqwest_client().dns_resolver(resolver.clone()),
&silo1.login_url(nexus_port),
Expand Down
4 changes: 2 additions & 2 deletions nexus/tests/integration_tests/silos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2155,11 +2155,11 @@ pub async fn verify_silo_dns_name(
.await
{
Ok(result) => {
let addrs: Vec<_> = result.iter().collect();
let addrs: Vec<_> = result.iter().map(|a| a.0).collect();
if addrs.is_empty() {
false
} else {
assert_eq!(addrs, [&nexus_ip]);
assert_eq!(addrs, [nexus_ip]);
true
}
}
Expand Down
55 changes: 55 additions & 0 deletions wicket/src/cli/command.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

//! Code that manages command dispatch from a shell for wicket.
use std::net::SocketAddrV6;

use anyhow::{Context, Result};
use clap::Parser;

use super::{
preflight::PreflightArgs, rack_setup::SetupArgs, upload::UploadArgs,
};

pub fn exec(
log: slog::Logger,
args: &str,
wicketd_addr: SocketAddrV6,
) -> Result<()> {
// The argument is in a quoted form, so split it using Unix shell semantics.
let args = shell_words::split(&args).with_context(|| {
format!("could not parse shell arguments from input {args}")
})?;

// parse_from uses the the first argument as the command name. Insert "wicket" as
// the command name.
let args = ShellCommand::parse_from(
std::iter::once("wicket".to_owned()).chain(args),
);
match args {
ShellCommand::UploadRepo(args) => args.exec(log, wicketd_addr),
ShellCommand::Setup(args) => args.exec(log, wicketd_addr),
ShellCommand::Preflight(args) => args.exec(log, wicketd_addr),
}
}

/// Arguments passed to wicket.
///
/// Wicket is designed to be used as a captive shell, set up via sshd
/// ForceCommand. If no arguments are specified, wicket behaves like a TUI.
/// However, if arguments are specified via SSH_ORIGINAL_COMMAND, wicketd
/// accepts an upload command.
#[derive(Debug, Parser)]
enum ShellCommand {
/// Upload a TUF repository to wicketd.
#[command(visible_alias = "upload")]
UploadRepo(UploadArgs),
/// Interact with rack setup configuration.
#[command(subcommand)]
Setup(SetupArgs),
/// Run checks prior to setting up the rack.
#[command(subcommand)]
Preflight(PreflightArgs),
}
18 changes: 18 additions & 0 deletions wicket/src/cli/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

// Copyright 2023 Oxide Computer Company

//! Command-line interface to wicket.
//!
//! By default, the main interface to wicket is via a TUI. However, some
//! commands and use cases must be done via the CLI, and this module contains
//! support for that.
mod command;
mod preflight;
mod rack_setup;
mod upload;

pub use command::exec;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 2 additions & 38 deletions wicket/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,19 @@ use std::net::{Ipv6Addr, SocketAddrV6};

use anyhow::{bail, Context, Result};
use camino::{Utf8Path, Utf8PathBuf};
use clap::Parser;
use omicron_common::{address::WICKETD_PORT, FileKv};
use slog::Drain;

use crate::{
preflight::PreflightArgs, rack_setup::SetupArgs, upload::UploadArgs, Runner,
};
use crate::Runner;

pub fn exec() -> Result<()> {
let wicketd_addr =
SocketAddrV6::new(Ipv6Addr::LOCALHOST, WICKETD_PORT, 0, 0);

// SSH_ORIGINAL_COMMAND contains additional arguments, if any.
if let Ok(ssh_args) = std::env::var("SSH_ORIGINAL_COMMAND") {
// The argument is in a quoted form, so split it using Unix shell semantics.
let args = shell_words::split(&ssh_args).with_context(|| {
format!("could not parse shell arguments from input {ssh_args}")
})?;

let log = setup_log(&log_path()?, WithStderr::Yes)?;
// parse_from uses the the first argument as the command name. Insert "wicket" as
// the command name.
let args = ShellCommand::parse_from(
std::iter::once("wicket".to_owned()).chain(args),
);
match args {
ShellCommand::UploadRepo(args) => args.exec(log, wicketd_addr),
ShellCommand::Setup(args) => args.exec(log, wicketd_addr),
ShellCommand::Preflight(args) => args.exec(log, wicketd_addr),
}
crate::cli::exec(log, &ssh_args, wicketd_addr)
} else {
// Do not expose log messages via standard error since they'll show up
// on top of the TUI.
Expand All @@ -46,25 +29,6 @@ pub fn exec() -> Result<()> {
}
}

/// Arguments passed to wicket.
///
/// Wicket is designed to be used as a captive shell, set up via sshd
/// ForceCommand. If no arguments are specified, wicket behaves like a TUI.
/// However, if arguments are specified via SSH_ORIGINAL_COMMAND, wicketd
/// accepts an upload command.
#[derive(Debug, Parser)]
enum ShellCommand {
/// Upload a TUF repository to wicketd.
#[command(visible_alias = "upload")]
UploadRepo(UploadArgs),
/// Interact with rack setup configuration.
#[command(subcommand)]
Setup(SetupArgs),
/// Run checks prior to setting up the rack.
#[command(subcommand)]
Preflight(PreflightArgs),
}

fn setup_log(
path: &Utf8Path,
with_stderr: WithStderr,
Expand Down
4 changes: 1 addition & 3 deletions wicket/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@
use std::time::Duration;

mod cli;
mod dispatch;
mod events;
mod keymap;
mod preflight;
mod rack_setup;
mod runner;
mod state;
mod ui;
mod upload;
mod wicketd;

pub const TICK_INTERVAL: Duration = Duration::from_millis(30);
Expand Down
8 changes: 4 additions & 4 deletions workspace-hack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ ipnetwork = { version = "0.20.0", features = ["schemars"] }
itertools = { version = "0.10.5" }
lalrpop-util = { version = "0.19.12" }
lazy_static = { version = "1.4.0", default-features = false, features = ["spin_no_std"] }
libc = { version = "0.2.149", features = ["extra_traits"] }
libc = { version = "0.2.150", features = ["extra_traits"] }
log = { version = "0.4.20", default-features = false, features = ["std"] }
managed = { version = "0.8.0", default-features = false, features = ["alloc", "map"] }
memchr = { version = "2.6.3" }
Expand Down Expand Up @@ -99,7 +99,7 @@ tracing = { version = "0.1.37", features = ["log"] }
unicode-bidi = { version = "0.3.13" }
unicode-normalization = { version = "0.1.22" }
usdt = { version = "0.3.5" }
uuid = { version = "1.4.1", features = ["serde", "v4"] }
uuid = { version = "1.5.0", features = ["serde", "v4"] }
yasna = { version = "0.5.2", features = ["bit-vec", "num-bigint", "std", "time"] }
zeroize = { version = "1.6.0", features = ["std", "zeroize_derive"] }
zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"] }
Expand Down Expand Up @@ -149,7 +149,7 @@ ipnetwork = { version = "0.20.0", features = ["schemars"] }
itertools = { version = "0.10.5" }
lalrpop-util = { version = "0.19.12" }
lazy_static = { version = "1.4.0", default-features = false, features = ["spin_no_std"] }
libc = { version = "0.2.149", features = ["extra_traits"] }
libc = { version = "0.2.150", features = ["extra_traits"] }
log = { version = "0.4.20", default-features = false, features = ["std"] }
managed = { version = "0.8.0", default-features = false, features = ["alloc", "map"] }
memchr = { version = "2.6.3" }
Expand Down Expand Up @@ -194,7 +194,7 @@ unicode-bidi = { version = "0.3.13" }
unicode-normalization = { version = "0.1.22" }
unicode-xid = { version = "0.2.4" }
usdt = { version = "0.3.5" }
uuid = { version = "1.4.1", features = ["serde", "v4"] }
uuid = { version = "1.5.0", features = ["serde", "v4"] }
yasna = { version = "0.5.2", features = ["bit-vec", "num-bigint", "std", "time"] }
zeroize = { version = "1.6.0", features = ["std", "zeroize_derive"] }
zip = { version = "0.6.6", default-features = false, features = ["bzip2", "deflate"] }
Expand Down

0 comments on commit 9510f2a

Please sign in to comment.