oxidecomputer / oxidecomputer/oxide.rs

panic misusing --json-body argument

Open
#449 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
75
Forks
21
Avg merge
2d 2h
Merged PRs (30d)
19

Description

Trying to work around a bug in image import, I tried to create an image from a URL. I wasn't sure how to use it:

$ oxide image create
error: the following required arguments were not provided:
  --json-body <JSON-FILE>
  --description <description>
  --name <name>
  --os <os>
  --version <version>

In terms of the json-body, I thought I could guess my way there:

$ echo '{"source": { "url": "http://catacomb.eng.oxide.computer/media/cloud/debian-11-genericcloud-amd64.raw", block_size: 512 } }' | oxide image create --name my-image --description my-description --os debian --version 11 --json-body -
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }', cli/src/generated_cli.rs:5800:59
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(17), ...)', cli/src/main.rs:59:10

I guess it doesn't treat - as stdin and then panicked because it tried to open it and it wasn't there?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the command using --json-body - and start at cli/src/generated_cli.rs:5800, then follow the call from cli/src/main.rs:59. Check how the JSON body path is opened and how failures are reported. Done means the command no longer panics when given this input and its stdin or file behavior is handled consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.