Skip to content

Instantly share code, notes, and snippets.

@yankcrime
Created October 14, 2015 15:43
Show Gist options
  • Select an option

  • Save yankcrime/c0b6f35f9f91e62b4340 to your computer and use it in GitHub Desktop.

Select an option

Save yankcrime/c0b6f35f9f91e62b4340 to your computer and use it in GitHub Desktop.
nova::vncserver::common
# == Class: nova::vncproxy::common
#
# [*vncproxy_host*]
# (optional) The host of the VNC proxy server
# Defaults to false
#
# [*vncproxy_protocol*]
# (optional) The protocol to communicate with the VNC proxy server
# Defaults to 'http'
#
# [*vncproxy_port*]
# (optional) The port to communicate with the VNC proxy server
# Defaults to '6080'
#
# [*vncproxy_path*]
# (optional) The path at the end of the uri for communication with the VNC proxy server
# Defaults to '/vnc_auto.html'
#
class nova::vncproxy::common (
$vncproxy_host = undef,
$vncproxy_protocol = undef,
$vncproxy_port = undef,
$vncproxy_path = undef,
) {
if defined(Nova::Compute::Vncproxy_host) {
$_vncproxy_host = $::nova::compute::vncproxy_host
} elsif defined(Nova::Vncproxy::Host) {
$_vncproxy_host = $::nova::vncproxy::host
}
if defined(Nova::Compute::Vncproxy_protocol) {
$_vncproxy_protocol = $::nova::compute::vncproxy_protocol
} elsif defined(Nova::Vncproxy::Vncproxy_protocol) {
$_vncproxy_protocol = $::nova::vncproxy::vncproxy_protocol
}
if defined(Nova::Compute::Vncproxy_port) {
$_vncproxy_port = $::nova::compute::vncproxy_port
} elsif defined(Nova::Vncproxy::Vncproxy_port) {
$_vncproxy_port = $::nova::vncproxy::vncproxy_port
}
if defined(Nova::Compute::Vncproxy_path) {
$_vncproxy_path = $::nova::compute::vncproxy_path
} elsif defined(Nova::Vncproxy::Vncproxy_path) {
$_vncproxy_path = $::nova::vncproxy::vncproxy_path
}
$vncproxy_host_real = pick(
$vncproxy_host,
$_vncproxy_host,
false)
$vncproxy_protocol_real = pick(
$vncproxy_protocol,
$_vncproxy_protocol,
'http')
$vncproxy_port_real = pick(
$vncproxy_port,
$_vncproxy_port,
6080)
$vncproxy_path_real = pick(
$vncproxy_path,
$_vncproxy_path,
'/vnc_auto.html')
if ($vncproxy_host_real) {
$vncproxy_base_url = "${vncproxy_protocol_real}://${vncproxy_host_real}:${vncproxy_port_real}${vncproxy_path_real}"
# config for vnc proxy
nova_config {
'DEFAULT/novncproxy_base_url': value => $vncproxy_base_url;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment