Nodepool image logs accessible via HTTP

Nodepool logs the creation of nodepool images to an image.log which
are only accessible to root users. This change updates the nodepool
puppet configuration to install apache and allows users to access
these image logs.

Change-Id: I867030c258d00ce017c69812c133f3419215d045
This commit is contained in:
Matthew Oliver 2014-02-05 16:52:46 +11:00
parent c3811872cd
commit 8e9853cd4c
3 changed files with 39 additions and 7 deletions

View File

@ -23,7 +23,10 @@ class nodepool (
$nodepool_ssh_private_key = '',
$git_source_repo = 'https://git.openstack.org/openstack-infra/nodepool',
$revision = 'master',
$statsd_host = ''
$statsd_host = '',
$vhost_name = 'nodepool.openstack.org',
$image_log_document_root = '/var/log/nodepool/image',
$enable_image_log_via_http = false,
) {
class { 'mysql::server':
@ -144,7 +147,7 @@ class nodepool (
mode => '0444',
owner => 'root',
group => 'root',
source => 'puppet:///modules/nodepool/logging.conf',
content => template('nodepool/nodepool.logging.conf.erb'),
notify => Service['nodepool'],
}
@ -162,4 +165,28 @@ class nodepool (
hasrestart => true,
require => File['/etc/init.d/nodepool'],
}
if $enable_image_log_via_http == true {
# Setup apache for image log access
include apache
apache::vhost { $vhost_name:
port => 80,
priority => '50',
docroot => $image_log_document_root,
}
if $image_log_document_root != '/var/log/nodepool' {
file { $image_log_document_root:
ensure => directory,
mode => '0755',
owner => 'nodepool',
group => 'nodepool',
require => [
User['nodepool'],
File['/var/log/nodepool'],
],
}
}
}
}

View File

@ -49,7 +49,7 @@ args=('/var/log/nodepool/nodepool.log', 'midnight', 1, 30,)
level=INFO
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('/var/log/nodepool/image.log', 'midnight', 1, 30,)
args=('<%= @image_log_document_root %>/image.log', 'midnight', 1, 30,)
[formatter_simple]
format=%(asctime)s %(levelname)s %(name)s: %(message)s

View File

@ -19,16 +19,21 @@ class openstack_project::nodepool(
$tripleo_username ='',
$tripleo_password ='',
$tripleo_project ='',
$image_log_document_root = '/var/log/nodepool/image',
$enable_image_log_via_http = true,
) {
class { 'openstack_project::server':
sysadmins => $sysadmins,
iptables_public_tcp_ports => [80],
}
class { '::nodepool':
mysql_root_password => $mysql_root_password,
mysql_password => $mysql_password,
nodepool_ssh_private_key => $nodepool_ssh_private_key,
statsd_host => $statsd_host,
mysql_root_password => $mysql_root_password,
mysql_password => $mysql_password,
nodepool_ssh_private_key => $nodepool_ssh_private_key,
statsd_host => $statsd_host,
image_log_document_root => $image_log_document_root,
enable_image_log_via_http => $enable_image_log_via_http,
}
file { '/etc/nodepool/nodepool.yaml':