Skip to content

Commit

Permalink
only set randompasswd in graphics template if it's true (#535)
Browse files Browse the repository at this point in the history
Small fix in the template schemas for older OpenNebula versions. 

Older OpenNebula versions (like 5.12) interpret the `RANDOM_PASSWORD`
as truthy if its value is not empty and therefore try to generate a
password, which when using VNC will not be truncated due to another
bug that's already been fixed in the latest release.
  • Loading branch information
nilsding authored Oct 21, 2024
1 parent 106877b commit 26335f4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions opennebula/shared_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,14 @@ func addGraphic(tpl *vm.Template, graphics []interface{}) {
case "passwd":
tpl.AddIOGraphic(vmk.Passwd, v.(string))
case "random_passwd":
// Convert bool to string
tpl.AddIOGraphic(vmk.RandomPassword, map[bool]string{true: "YES", false: "NO"}[v.(bool)])
// only set random_passwd if it's set to true -- older OpenNebula versions will consider any
// non-zero string as a yes
if v.(bool) {
tpl.AddIOGraphic(vmk.RandomPassword, "YES")
}
}

}
}

}
}

Expand Down

0 comments on commit 26335f4

Please sign in to comment.