Add image upload log arguments
Add image upload log directory and arguments. This is where provider upload logs configured in Ic80e532891f039e0f835847ddfbae38f1ce3cd8aIf can be stored. Note http export (which we do not enable in infra at this time) would put logs under /upload ; it might be more logical to move the build logs to be a sibling at /build but that would be backwards incompatbile. Change-Id: I0cc9b59063fb14920f0da581b8036c2664d5d5f1
This commit is contained in:
parent
d70a85b686
commit
cd086492a4
|
@ -29,6 +29,10 @@ class nodepool (
|
||||||
$image_log_document_root = '/var/log/nodepool/image',
|
$image_log_document_root = '/var/log/nodepool/image',
|
||||||
$image_log_periodic_cleanup = false,
|
$image_log_periodic_cleanup = false,
|
||||||
$enable_image_log_via_http = false,
|
$enable_image_log_via_http = false,
|
||||||
|
$upload_log_document_root = '/var/log/nodepool/upload',
|
||||||
|
$upload_log_periodic_cleanup = false,
|
||||||
|
# note : not currently supported
|
||||||
|
$enable_upload_log_via_http = false,
|
||||||
$environment = {},
|
$environment = {},
|
||||||
# enable sudo for nodepool user. Useful for using dib with nodepool
|
# enable sudo for nodepool user. Useful for using dib with nodepool
|
||||||
$sudo = true,
|
$sudo = true,
|
||||||
|
@ -342,8 +346,24 @@ class nodepool (
|
||||||
require => File['/etc/init.d/nodepool'],
|
require => File['/etc/init.d/nodepool'],
|
||||||
}
|
}
|
||||||
|
|
||||||
if $enable_image_log_via_http == true {
|
if $image_log_document_root == $upload_log_document_root {
|
||||||
# Setup apache for image log access
|
# It makes no sense to ask to not export build or upload logs, but
|
||||||
|
# then have them log to the same directory that will be exported.
|
||||||
|
if (($enable_image_log_via_http and !$enable_upload_log_via_http) or
|
||||||
|
($enable_upload_log_via_http and !$enable_image_log_via_http)
|
||||||
|
) {
|
||||||
|
fail('Unexported logs in same directory as exported logs!')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# we only need to create the upload log dir if it is separate to the
|
||||||
|
# image log.
|
||||||
|
$separate_upload_log_dir =
|
||||||
|
$image_log_document_root != $upload_log_document_root
|
||||||
|
|
||||||
|
if $enable_image_log_via_http == true or
|
||||||
|
$enable_upload_log_via_http == true {
|
||||||
|
# Setup apache for log access
|
||||||
include ::httpd
|
include ::httpd
|
||||||
|
|
||||||
::httpd::vhost { $vhost_name:
|
::httpd::vhost { $vhost_name:
|
||||||
|
@ -376,6 +396,21 @@ class nodepool (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# we only need this if it is different to the image_log
|
||||||
|
if $separate_upload_log_dir
|
||||||
|
{
|
||||||
|
file { $upload_log_document_root:
|
||||||
|
ensure => directory,
|
||||||
|
mode => '0755',
|
||||||
|
owner => 'nodepool',
|
||||||
|
group => 'nodepool',
|
||||||
|
require => [
|
||||||
|
User['nodepool'],
|
||||||
|
File['/var/log/nodepool'],
|
||||||
|
],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# run a cleanup on the image log directory to cleanup logs for
|
# run a cleanup on the image log directory to cleanup logs for
|
||||||
# images that are no longer being built
|
# images that are no longer being built
|
||||||
if $image_log_periodic_cleanup == true {
|
if $image_log_periodic_cleanup == true {
|
||||||
|
@ -388,6 +423,18 @@ class nodepool (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# run a cleanup on the upload log directory to cleanup logs for
|
||||||
|
# providers that are no long uploading
|
||||||
|
if $upload_log_periodic_cleanup == true {
|
||||||
|
cron { 'upload_log_cleanup':
|
||||||
|
user => 'nodepool',
|
||||||
|
hour => '1',
|
||||||
|
minute => '0',
|
||||||
|
command => "find ${upload_log_document_root} \\( -name '*.log' -o -name '*.log.*' \\) -mtime +7 -execdir rm {} \\;",
|
||||||
|
environment => 'PATH=/usr/bin:/bin:/usr/sbin:/sbin',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if $sudo == true {
|
if $sudo == true {
|
||||||
$sudo_file_ensure = present
|
$sudo_file_ensure = present
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,23 @@
|
||||||
ServerName <%= scope.lookupvar("nodepool::vhost_name") %>
|
ServerName <%= scope.lookupvar("nodepool::vhost_name") %>
|
||||||
|
|
||||||
DocumentRoot <%= scope.lookupvar("nodepool::image_log_document_root") %>
|
DocumentRoot <%= scope.lookupvar("nodepool::image_log_document_root") %>
|
||||||
|
|
||||||
|
<% if scope.lookupvar("nodepool::enable_image_log_via_http") -%>
|
||||||
<Directory <%= scope.lookupvar("nodepool::image_log_document_root") %>>
|
<Directory <%= scope.lookupvar("nodepool::image_log_document_root") %>>
|
||||||
Options <%= scope.lookupvar("httpd::params::options") %>
|
Options <%= scope.lookupvar("httpd::params::options") %>
|
||||||
AllowOverride None
|
AllowOverride None
|
||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
|
<% if scope.lookupvar("nodepool::enable_upload_log_via_http") and scope.lookupvar("nodepool::separate_upload_log_dir") -%>
|
||||||
|
Alias "/upload" <%= scope.lookupvar("nodepool::upload_log_document_root") %>
|
||||||
|
<Directory <%= scope.lookupvar("nodepool::upload_log_document_root") %> >
|
||||||
|
Options <%= scope.lookupvar("httpd::params::options") %>
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/nodepool_error.log
|
ErrorLog /var/log/<%= scope.lookupvar("httpd::params::apache_name") %>/nodepool_error.log
|
||||||
LogLevel warn
|
LogLevel warn
|
||||||
|
|
Loading…
Reference in New Issue