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

instance nic update panics if invalid IpNet is supplied in json-body #1013

Open
1 of 4 tasks
taspelund opened this issue Feb 12, 2025 · 2 comments
Open
1 of 4 tasks
Assignees
Labels
bug Issue relating to unexpected behaviour

Comments

@taspelund
Copy link
Contributor

Component

  • CLI
  • SDK
  • Something else
  • Not sure

What was the expected behaviour

An error, not a panic... i.e. don't call unwrap()

What is the current behaviour and what actions did you take to get there

treyaspelund@Tallon-IV 11:08:13 AM | ~/Downloads
‣ ./oxide --profile sandbox instance nic update --interface cba51266-68a8-4f86-a57d-e06a501f6020 --json-body transit_ips_invalid.json
thread 'tokio-runtime-worker' panicked at cli/src/generated_cli.rs:9658:90:
called `Result::unwrap()` on an `Err` value: Error("data did not match any variant of untagged enum IpNet", line: 2, column: 83)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at cli/src/main.rs:107:10:
called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(9), "called `Result::unwrap()` on an `Err` value: Error(\"data did not match any variant of untagged enum IpNet\", line: 2, column: 83)", ...)

✕ treyaspelund@Tallon-IV 11:08:48 AM | ~/Downloads
‣ cat transit_ips_invalid.json
{
  "transit_ips": ["127.0.0.8/32", "100.64.1.1/24", "224.0.0.44/26", "400.0.0.0/32"]
}

CLI or SDK version

0.8.0+20241009.0

Operating system

MacOS Sonoma 14.5

Anything else you would like to add?

✕ treyaspelund@Tallon-IV 11:09:58 AM | ~/Downloads
‣ ./oxide version
Oxide CLI 0.8.0+20241009.0
Built from commit: 1aa4b473a0514f8a388b10ad249033264cba298c
Oxide API: 20241009.0
@taspelund taspelund added the bug Issue relating to unexpected behaviour label Feb 12, 2025
@david-crespo
Copy link
Contributor

david-crespo commented Feb 12, 2025

Could you try running it with --debug? I'm not clear from the error whether it's failing while trying to parse the request body or the response body.

Edit: oh I see. Presumably this unwrap on the request body.

oxide.rs/cli/src/generated_cli.rs

Lines 10350 to 10355 in d448c2e

if let Some(value) = matches.get_one::<std::path::PathBuf>("json-body") {
let body_txt = std::fs::read_to_string(value).unwrap();
let body_value =
serde_json::from_str::<types::InstanceNetworkInterfaceUpdate>(&body_txt).unwrap();
request = request.body(body_value);
}

@ahl
Copy link
Collaborator

ahl commented Feb 13, 2025

Yeah; this is known, undone work in progenitor.

@ahl ahl self-assigned this Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue relating to unexpected behaviour
Projects
None yet
Development

No branches or pull requests

3 participants