From 342eda2a9de1aff98d459d430ebddc83abb1f9d7 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 31 Dec 2013 11:11:55 -0800 Subject: [PATCH] Move elastic-recheck bot to status.o.o Also, normalize some parameters to the status manifest to make it more readable (since they follow the same pattern). And make the ssh config for elastic-recheck bot match reviewday. Change-Id: I2417f121e7b3685aab9540504cdd4c6db1754e67 --- manifests/bot.pp | 49 ++++++++++++++++++++++-------- templates/elastic-recheck.conf.erb | 4 +-- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/manifests/bot.pp b/manifests/bot.pp index da5c297..79a6a6c 100644 --- a/manifests/bot.pp +++ b/manifests/bot.pp @@ -18,13 +18,12 @@ # class elastic_recheck::bot ( $gerrit_host, - $gerrit_ssh_private_key, - $gerrit_ssh_private_key_contents, - #not used today, will be used when elastic-recheck supports it. - $elasticsearch_url, + $gerrit_ssh_host_key = '', + $recheck_gerrit_user = 'elasticrecheck', + $recheck_ssh_private_key = '', + $recheck_ssh_public_key = '', $recheck_bot_passwd, - $gerrit_user = 'elasticrecheck', - $recheck_bot_nick = 'openstackrecheck', + $recheck_bot_nick, ) { include elastic_recheck @@ -53,13 +52,37 @@ class elastic_recheck::bot ( require => Class['elastic_recheck'], } - file { $gerrit_ssh_private_key: - ensure => present, - mode => '0600', - owner => 'recheck', - group => 'recheck', - content => $gerrit_ssh_private_key_contents, - require => Class['elastic_recheck'], + if $recheck_ssh_private_key != '' { + file { '/home/recheck/.ssh/id_rsa': + owner => 'recheck', + group => 'recheck', + mode => '0600', + content => $recheck_ssh_private_key, + replace => true, + require => File['/home/recheck/.ssh/'] + } + } + + if $recheck_ssh_public_key != '' { + file { '/home/recheck/.ssh/id_rsa.pub': + owner => 'recheck', + group => 'recheck', + mode => '0600', + content => $recheck_ssh_public_key, + replace => true, + require => File['/home/recheck/.ssh/'] + } + } + + if $gerrit_ssh_host_key != '' { + file { '/home/recheck/.ssh/known_hosts': + owner => 'recheck', + group => 'recheck', + mode => '0600', + content => "${gerrit_host} ${gerrit_ssh_host_key}", + replace => true, + require => File['/home/recheck/.ssh/'] + } } file { '/etc/init.d/elastic-recheck': diff --git a/templates/elastic-recheck.conf.erb b/templates/elastic-recheck.conf.erb index e28a0ef..c1da4bb 100644 --- a/templates/elastic-recheck.conf.erb +++ b/templates/elastic-recheck.conf.erb @@ -8,7 +8,7 @@ channel_config=/etc/elastic-recheck/recheckwatchbot.yaml log_config=/etc/elastic-recheck/logging.config [gerrit] -user=<%= gerrit_user %> host=<%= gerrit_host %> +user=<%= recheck_gerrit_user %> query_file=/etc/elastic-recheck/queries -key=<%= gerrit_ssh_private_key %> +key=/home/recheck/.ssh/id_rsa