964dbc45be
* modules/reviewday/manifests/site.pp: The frequency of the update reviewday cron job is now every half hour instead of every quarter hour. Additionally, a lock is added to prevent overlapping runs in case the script begins to take longer. This is needed since recent Launchpad API changes have caused it to perform considerably slower than before. Change-Id: I9fcdbb350a61ab29200068406ccb8b8eaa5e4244 Reviewed-on: https://review.openstack.org/28331 Reviewed-by: Dan Prince <dprince@redhat.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Approved: Jeremy Stanley <fungi@yuggoth.org> Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Tested-by: Jenkins
109 lines
2.9 KiB
Puppet
109 lines
2.9 KiB
Puppet
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
# == Define: reviewday
|
|
#
|
|
define reviewday::site(
|
|
$gerrit_url = '',
|
|
$gerrit_port = '',
|
|
$gerrit_user = '',
|
|
$reviewday_rsa_key_contents = '',
|
|
$reviewday_rsa_pubkey_contents = '',
|
|
$reviewday_gerrit_ssh_key = '',
|
|
$git_url = '',
|
|
$httproot = '',
|
|
$serveradmin = ''
|
|
) {
|
|
|
|
file { '/var/lib/reviewday/.ssh/':
|
|
ensure => directory,
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0700',
|
|
require => User['reviewday'],
|
|
}
|
|
|
|
if $reviewday_rsa_key_contents != '' {
|
|
file { '/var/lib/reviewday/.ssh/id_rsa':
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0600',
|
|
content => $reviewday_rsa_key_contents,
|
|
replace => true,
|
|
require => File['/var/lib/reviewday/.ssh/']
|
|
}
|
|
}
|
|
|
|
if $reviewday_rsa_pubkey_contents != '' {
|
|
file { '/var/lib/reviewday/.ssh/id_rsa.pub':
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0600',
|
|
content => $reviewday_rsa_pubkey_contents,
|
|
replace => true,
|
|
require => File['/var/lib/reviewday/.ssh/']
|
|
}
|
|
}
|
|
|
|
if $reviewday_gerrit_ssh_key != '' {
|
|
file { '/var/lib/reviewday/.ssh/known_hosts':
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0600',
|
|
content => "${gerrit_url} ${reviewday_gerrit_ssh_key}",
|
|
replace => true,
|
|
require => File['/var/lib/reviewday/.ssh/']
|
|
}
|
|
}
|
|
|
|
file {'/var/lib/reviewday/reviewday':
|
|
ensure => directory,
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0755',
|
|
require => File['/var/lib/reviewday/'],
|
|
}
|
|
|
|
vcsrepo { '/var/lib/reviewday/reviewday':
|
|
ensure => latest,
|
|
provider => git,
|
|
source => $git_url,
|
|
revision => 'master',
|
|
}
|
|
|
|
file { $httproot:
|
|
ensure => directory,
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0755',
|
|
}
|
|
|
|
file { '/var/lib/reviewday/.ssh/config':
|
|
ensure => present,
|
|
content => template('reviewday/ssh_config.erb'),
|
|
owner => 'reviewday',
|
|
group => 'reviewday',
|
|
mode => '0644',
|
|
}
|
|
|
|
cron { 'update reviewday':
|
|
command => "cd /var/lib/reviewday/reviewday && PYTHONPATH=\$PWD flock -n /var/lib/reviewday/update.lock python bin/reviewday -o ${httproot}",
|
|
minute => '*/30',
|
|
user => 'reviewday',
|
|
}
|
|
|
|
}
|
|
|
|
# vim:sw=2:ts=2:expandtab:textwidth=79
|