File: common.pp

package info (click to toggle)
puppet-module-nova 25.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,100 kB
  • sloc: ruby: 11,433; python: 38; sh: 10; makefile: 10
file content (107 lines) | stat: -rw-r--r-- 2,864 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# == Class: nova::vncproxy::common
#
# [*vncproxy_host*]
#   (optional) The host of the VNC proxy server
#   Defaults to undef
#
# [*vncproxy_protocol*]
#   (optional) The protocol to communicate with the VNC proxy server
#   Defaults to undef
#
# [*vncproxy_port*]
#   (optional) The port to communicate with the VNC proxy server
#   Defaults to undef
#
# [*vncproxy_path*]
#   (optional) The path at the end of the uri for communication with the VNC proxy server
#   Defaults to undef
#
class nova::vncproxy::common (
  $vncproxy_host     = undef,
  $vncproxy_protocol = undef,
  $vncproxy_port     = undef,
  $vncproxy_path     = undef,
) {

  include nova::deps

  if defined('$::nova::compute::vncproxy_host') {
    $compute_vncproxy_host_real = $::nova::compute::vncproxy_host
  } else {
    $compute_vncproxy_host_real = undef
  }

  if defined('$::nova::vncproxy::host') {
    $compat_vncproxy_host_real = $::nova::vncproxy::host
  } else {
    $compat_vncproxy_host_real = undef
  }

  $vncproxy_host_real = normalize_ip_for_uri(pick(
    $vncproxy_host,
    $compute_vncproxy_host_real,
    $compat_vncproxy_host_real,
    false))

  if defined('$::nova::compute::vncproxy_protocol') {
    $compute_vncproxy_protocol_real = $::nova::compute::vncproxy_protocol
  } else {
    $compute_vncproxy_protocol_real = undef
  }

  if defined('$::nova::vncproxy::vncproxy_protocol') {
    $compat_vncproxy_protocol_real = $::nova::vncproxy::vncproxy_protocol
  } else {
    $compat_vncproxy_protocol_real = undef
  }

  $vncproxy_protocol_real = pick(
    $vncproxy_protocol,
    $compute_vncproxy_protocol_real,
    $compat_vncproxy_protocol_real,
    'http')

  if defined('$::nova::compute::vncproxy_port') {
    $compute_vncproxy_port_real = $::nova::compute::vncproxy_port
  } else {
    $compute_vncproxy_port_real = undef
  }

  if defined('$::nova::vncproxy::port') {
    $compat_vncproxy_port_real = $::nova::vncproxy::port
  } else {
    $compat_vncproxy_port_real = undef
  }

  $vncproxy_port_real = pick(
    $vncproxy_port,
    $compute_vncproxy_port_real,
    $compat_vncproxy_port_real,
    6080)

  if defined('$::nova::compute::vncproxy_path') {
    $compute_vncproxy_path_real = $::nova::compute::vncproxy_path
  } else {
    $compute_vncproxy_path_real = undef
  }

  if defined('$::nova::vncproxy::vncproxy_path') {
    $compat_vncproxy_path_real = $::nova::vncproxy::vncproxy_path
  } else {
    $compat_vncproxy_path_real = undef
  }

  $vncproxy_path_real = pick(
    $vncproxy_path,
    $compute_vncproxy_path_real,
    $compat_vncproxy_path_real,
    '/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 {
      'vnc/novncproxy_base_url': value => $vncproxy_base_url;
    }
  }
}