Skip to content

Commit

Permalink
only set randompasswd in graphics template if it's true
Browse files Browse the repository at this point in the history
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

(yes, I know, we should really update our setup ...)
  • Loading branch information
nilsding committed Mar 25, 2024
1 parent 9ac3407 commit 8d10d2b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions opennebula/shared_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -632,8 +632,11 @@ 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 8d10d2b

Please sign in to comment.