From 3dc706802075e97bf5af2068cef2a3c1bfa3966a Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Tue, 4 Aug 2015 14:05:32 +1000 Subject: [PATCH] Call register-zanata-projects on translate-dev To allow us to register projects in Zanata automatically, pull in jeepyb, and subscribe to the projects.yaml file to run it when it changes. This makes use of the wildfly user and home directory as a useful place to copy and subscribe to the projects.yaml file. Change-Id: I25bd20a38315819b79049dd947ada40029a92163 Depends-On: Id0229864b64ce39c70b559e1eb5d94822f1988ec Depends-On: Id78a590ea07b886afc0c98e309ff6df45f2240bf --- manifests/site.pp | 3 ++ .../manifests/translate_dev.pp | 49 +++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/manifests/site.pp b/manifests/site.pp index 1c53e141d4..748259b051 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -882,6 +882,9 @@ node 'translate-dev.openstack.org' { from_address => 'noreply@openstack.org', mysql_host => hiera('translate_dev_mysql_host', 'localhost'), mysql_password => hiera('translate_dev_mysql_password', 'XXX'), + zanata_server_user => hiera('proposal_zanata_user', 'XXX'), + zanata_server_api_key => hiera('proposal_zanata_api_key', 'XXX'), + project_config_repo => 'https://git.openstack.org/openstack-infra/project-config', } } diff --git a/modules/openstack_project/manifests/translate_dev.pp b/modules/openstack_project/manifests/translate_dev.pp index ba3aab8afb..a115a7c635 100644 --- a/modules/openstack_project/manifests/translate_dev.pp +++ b/modules/openstack_project/manifests/translate_dev.pp @@ -21,6 +21,9 @@ class openstack_project::translate_dev( $mysql_password, $admin_users = '', $sysadmins = [], + $zanata_server_user = '', + $zanata_server_api_key = '', + $project_config_repo = '', $openid_url = '', $vhost_name = $::fqdn, $ssl_cert_file = '/etc/ssl/certs/ssl-cert-snakeoil.pem', @@ -38,6 +41,10 @@ class openstack_project::translate_dev( iptables_public_tcp_ports => [80, 443], } + class { 'project_config': + url => $project_config_repo, + } + class { '::zanata': mysql_host => $mysql_host, mysql_port => $mysql_port, @@ -79,4 +86,46 @@ class openstack_project::translate_dev( ], require => Service['wildfly'], } + + file { '/home/wildfly/projects.yaml': + ensure => present, + owner => 'wildfly', + group => 'wildfly', + mode => '0444', + source => $::project_config::jeepyb_project_file, + replace => true, + require => User['wildfly'], + } + + include jeepyb + exec { 'register-zanata-projects': + command => '/usr/local/bin/register-zanata-projects >> /var/log/register-zanata-projects.log 2>&1', + timeout => 900, # 15 minutes + subscribe => File['/home/wildfly/projects.yaml'], + refreshonly => true, + logoutput => true, + environment => [ + "PROJECTS_YAML=/home/wildfly/projects.yaml", + "ZANATA_URL=https://${vhost_name}/", + "ZANATA_USER=${zanata_server_user}", + "ZANATA_KEY=${zanata_server_api_key}", + ], + require => [ + File['/home/wildfly/projects.yaml'], + Class['jeepyb'], + ], + } + + logrotate::file { 'register-zanata-projects.log': + log => '/var/log/register-zanata-projects.log', + options => [ + 'compress', + 'missingok', + 'rotate 30', + 'daily', + 'notifempty', + 'copytruncate', + ], + require => Exec['register-zanata-projects'], + } }