Skip to content
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
17 changes: 12 additions & 5 deletions api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,15 @@ pub trait SushApi {
headers: Header<Authorization>,
) -> Result<HttpResponseOk<Session>, HttpError>;

/// Check that this server would accept a job in a session.
/// Check that this server would accept a job in a session for a target.
///
/// Succeeds if the session is active or its start is pending.
#[endpoint { method = GET, path = "/sessions/{session_id}/check" }]
async fn session_check(
/// Succeeds if the session is active or its start is pending, and
/// the target resolves to at least one sled this server can reach.
#[endpoint { method = GET, path = "/sessions/{session_id}/preflight/{target}" }]
async fn job_preflight(
ctx: RequestContext<Self::Context>,
headers: Header<Authorization>,
params: PathParams<SessionIdParam>,
params: PathParams<SessionTargetParams>,
) -> Result<HttpResponseUpdatedNoContent, HttpError>;

/// Get a fresh server nonce for the session ceremony.
Expand Down Expand Up @@ -258,6 +259,12 @@ pub struct SessionIdParam {
pub session_id: SessionId,
}

#[derive(Deserialize, JsonSchema)]
pub struct SessionTargetParams {
pub session_id: SessionId,
pub target: String,
}

#[derive(Deserialize, JsonSchema)]
pub struct SessionAndJobIds {
pub session_id: SessionId,
Expand Down
12 changes: 1 addition & 11 deletions client/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,7 @@ impl CommandContext for Cli {
.collect::<Result<Vec<_>, CommandError>>()?;
qprintln!("{}", json!({"identities": identities}));
}
OutputFormat::Text if keys.is_empty() => self.note("❌ No SSH identities found"),
OutputFormat::Text if keys.is_empty() => self.note("❗ No SSH identities found"),
OutputFormat::Text => {
for key in keys {
let key_id = key.key_id()?;
Expand All @@ -1151,16 +1151,6 @@ impl CommandContext for Cli {
Ok(())
}

fn really_target(&mut self, sled: &SledId) -> Result<(), CommandError> {
if read_bool(&format!(
"❓ Sled `{sled}` is not in the rack inventory. Proceed (yes/no)? "
))? {
Ok(())
} else {
Err(CommandError::Canceled)
}
}

fn please_touch(&mut self, identity: &SshPublicKey) -> Result<(), CommandError> {
if identity.is_sk_algorithm() {
eprintln!(
Expand Down
Loading