Refactor of vncproxy

This commit refactors the vncproxy config.

It is intended to add multi-platform support.
This commit is contained in:
Dan Bode 2012-04-24 21:17:07 -07:00
parent cb6d7681ba
commit a40c19bf33
2 changed files with 52 additions and 41 deletions

View File

@ -26,6 +26,7 @@ class nova::params {
$objectstore_service_name = 'openstack-nova-objectstore'
$scheduler_service_name = 'openstack-nova-scheduler'
$tgt_service_name = 'tgtd'
$vncproxy_service_name = false
$volume_service_name = 'openstack-nova-volume'
$libvirt_package_name = 'libvirt'
$libvirt_service_name = 'libvirtd'
@ -47,7 +48,6 @@ class nova::params {
$scheduler_package_name = 'nova-scheduler'
$tgt_package_name = 'tgt'
$volume_package_name = 'nova-volume'
$vncproxy_package_name = 'nova-vncproxy'
# service names
$api_service_name = 'nova-api'
$cert_service_name = 'nova-cert'
@ -61,10 +61,14 @@ class nova::params {
$libvirt_service_name = 'libvirt-bin'
case $::operatingsystem {
'Debian': {
$vncproxy_package_name = 'novnc'
$vncproxy_service_name = 'novnc'
# Use default provider on Debian
$special_service_provider = undef
}
default: {
$vncproxy_package_name = false
$vncproxy_service_name = 'nova-novncproxy'
# some of the services need to be started form the special upstart provider
$special_service_provider = 'upstart'
}

View File

@ -1,4 +1,5 @@
class nova::vncproxy(
$enabled = false,
$host = '127.0.0.1',
$protocol = 'http',
$port = '6080',
@ -11,53 +12,59 @@ class nova::vncproxy(
# See http://nova.openstack.org/runnova/vncconsole.html for more details.
require git
nova_config { 'novncproxy_base_url': value => $novncproxy_base_url }
package { 'python-numpy':
ensure => present,
}
nova_config { 'novncproxy_base_url': value => $novncproxy_base_url }
package{ "noVNC":
ensure => purged,
}
file { '/etc/init.d/nova-novncproxy':
ensure => present,
source => 'puppet:///modules/nova/nova-novncproxy.init',
mode => 0750,
}
# this temporary upstart script needs to be removed
file { '/etc/init/nova-novncproxy.conf':
ensure => present,
content =>
'
description "nova noVNC Proxy server"
author "Etienne Pelletier <epelletier@morphlabs.com>"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
respawn
exec su -s /bin/bash -c "exec /var/lib/nova/noVNC/utils/nova-novncproxy --flagfile=/etc/nova/nova.conf --web=/var/lib/nova/noVNC" nova
',
mode => 0750,
}
# TODO this is terrifying, it is grabbing master
# I should at least check out a branch
vcsrepo { '/var/lib/nova/noVNC':
ensure => latest,
provider => git,
source => 'https://github.com/cloudbuilders/noVNC.git',
revision => 'HEAD',
require => Package['nova-api'],
nova::generic_service { 'vncproxy':
enabled => $enabled,
package_name => $::nova::params::vncproxy_package_name,
service_name => $::nova::params::vncproxy_service_name,
require => Package['python-numpy']
}
service { 'nova-novncproxy':
provider => upstart,
require => Vcsrepo['/var/lib/nova/noVNC']
if ($::osfamily == 'Debian') {
require git
package{ "noVNC":
ensure => purged,
}
file { '/etc/init.d/nova-novncproxy':
ensure => present,
source => 'puppet:///modules/nova/nova-novncproxy.init',
mode => 0750,
}
# this temporary upstart script needs to be removed
file { '/etc/init/nova-novncproxy.conf':
ensure => present,
content =>
'
description "nova noVNC Proxy server"
author "Etienne Pelletier <epelletier@morphlabs.com>"
start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [016]
respawn
exec su -s /bin/bash -c "exec /var/lib/nova/noVNC/utils/nova-novncproxy --flagfile=/etc/nova/nova.conf --web=/var/lib/nova/noVNC" nova
',
mode => 0750,
}
# TODO this is terrifying, it is grabbing master
# I should at least check out a branch
vcsrepo { '/var/lib/nova/noVNC':
ensure => latest,
provider => git,
source => 'https://github.com/cloudbuilders/noVNC.git',
revision => 'HEAD',
require => Package['nova-api'],
before => Nova::Generic_service['vncproxy'],
}
}
}