15b46330d1ee169e930c2e25c82a26861591432d
[mirror/dsa-puppet.git] / 3rdparty / modules / nova / manifests / vncproxy / common.pp
1 # == Class: nova::vncproxy::common
2 #
3 # [*vncproxy_host*]
4 #   (optional) The host of the VNC proxy server
5 #   Defaults to false
6 #
7 # [*vncproxy_protocol*]
8 #   (optional) The protocol to communicate with the VNC proxy server
9 #   Defaults to 'http'
10 #
11 # [*vncproxy_port*]
12 #   (optional) The port to communicate with the VNC proxy server
13 #   Defaults to '6080'
14 #
15 # [*vncproxy_path*]
16 #   (optional) The path at the end of the uri for communication with the VNC proxy server
17 #   Defaults to '/vnc_auto.html'
18 #
19 class nova::vncproxy::common (
20   $vncproxy_host     = undef,
21   $vncproxy_protocol = undef,
22   $vncproxy_port     = undef,
23   $vncproxy_path     = undef,
24 ) {
25
26   $vncproxy_host_real     = pick(
27     $vncproxy_host,
28     $::nova::compute::vncproxy_host,
29     $::nova::vncproxy::host,
30     false)
31   $vncproxy_protocol_real = pick(
32     $vncproxy_protocol,
33     $::nova::compute::vncproxy_protocol,
34     $::nova::vncproxy::vncproxy_protocol,
35     'http')
36   $vncproxy_port_real     = pick(
37     $vncproxy_port,
38     $::nova::compute::vncproxy_port,
39     $::nova::vncproxy::port,
40     6080)
41   $vncproxy_path_real     = pick(
42     $vncproxy_path,
43     $::nova::compute::vncproxy_path,
44     $::nova::vncproxy::vncproxy_path,
45     '/vnc_auto.html')
46
47   if ($vncproxy_host_real) {
48     $vncproxy_base_url = "${vncproxy_protocol_real}://${vncproxy_host_real}:${vncproxy_port_real}${vncproxy_path_real}"
49     # config for vnc proxy
50     nova_config {
51       'DEFAULT/novncproxy_base_url': value => $vncproxy_base_url;
52     }
53   }
54 }