Skip to content

Commit

Permalink
Fix failing to parse tool specifications in foreman.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
YetAnotherClown committed Jul 13, 2024
1 parent 0d3dea8 commit 4823481
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/discovery/foreman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ impl Manifest for ForemanManifest {
if let Some(map) = self.document.get("tools").and_then(|t| t.as_table()) {
for (alias, tool_def) in map {
let tool_alias = alias.parse::<ToolAlias>().ok();
let tool_spec = tool_def.as_table().and_then(parse_foreman_tool_definition);
let tool_spec = tool_def
.as_inline_table()
.and_then(parse_foreman_tool_definition);
if let (Some(alias), Some(spec)) = (tool_alias, tool_spec) {
tools.insert(alias, spec);
}
Expand All @@ -45,7 +47,7 @@ impl Manifest for ForemanManifest {
}
}

fn parse_foreman_tool_definition(map: &toml_edit::Table) -> Option<ToolSpec> {
fn parse_foreman_tool_definition(map: &toml_edit::InlineTable) -> Option<ToolSpec> {
let version = map.get("version").and_then(|t| t.as_str()).and_then(|v| {
// TODO: Support real version requirements instead of just exact/min versions
let without_prefix = v.trim_start_matches('=').trim_start_matches('^');
Expand Down

0 comments on commit 4823481

Please sign in to comment.