Skip to content

Commit

Permalink
Merge pull request #36 from tomleb/master
Browse files Browse the repository at this point in the history
Send 400 instead of 500 for unsupported basearch
  • Loading branch information
Luca Bruno committed Sep 29, 2020
2 parents af228d3 + 9f8a4c0 commit 2765ada
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion commons/src/policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn pick_basearch(input: Graph, basearch: String) -> Fallible<Graph> {
let key = format!("{}.{}", metadata::ARCH_PREFIX, &basearch);

if basearch != "x86_64" {
bail!("unexpected basearch '{}", basearch);
bail!("unexpected basearch '{}'", basearch);
}

for mut release in &mut graph.nodes {
Expand Down
8 changes: 7 additions & 1 deletion fcos-graph-builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ pub(crate) async fn gb_serve_graph(

let cached_graph = addr.send(scraper::GetCachedGraph { stream }).await??;

let arch_graph = policy::pick_basearch(cached_graph, basearch)?;
let arch_graph = match policy::pick_basearch(cached_graph, basearch) {
Err(e) => {
log::error!("error picking basearch: {}", e);
return Ok(HttpResponse::BadRequest().finish());
}
Ok(graph) => graph,
};
let final_graph = policy::filter_deadends(arch_graph);

let json =
Expand Down

0 comments on commit 2765ada

Please sign in to comment.