Skip to content

Commit

Permalink
machines: Fix Oops due to new OS autodetection code in VM creation di…
Browse files Browse the repository at this point in the history
…alog

Depending on libosinfo version, osinfo-detect prints sometimes the os name
together with a variant (Server/Workstation). However osinfo-query which
gives us the available OS list is not aware of the variants.

Note: There is already an open issue to make these two tools have
consistent outputs. https://gitlab.com/libosinfo/libosinfo/issues/24

Fixes #11628
Closes #11630
  • Loading branch information
KKoukiou authored and martinpitt committed Apr 17, 2019
1 parent e349abf commit 1125694
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/machines/components/create-vm-dialog/createVmDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,10 @@ class CreateVM extends React.Component {
// osinfo-query is nto yet aware of variants, https://gitlab.com/libosinfo/libosinfo/issues/24
// but osinfo-detect is. Remove the variant suffix to eliminate this issue
osName = osName.replace(/ Server$/, "");
osName = osName.replace(/ Workstation$/, "");
const osEntry = this.props.osInfoList.filter(osEntry => osEntry.name == osName);

if (osEntry) {
if (osEntry && osEntry[0]) {
this.setState({
vendor: osEntry[0].vendor,
os: osEntry[0].shortId
Expand Down

0 comments on commit 1125694

Please sign in to comment.