From a5e56843de4c735f18dfb0a3c57f4197551e1d81 Mon Sep 17 00:00:00 2001 From: Anita Kuno Date: Tue, 19 Mar 2013 12:18:17 -0400 Subject: [PATCH] Added swift store credentials to openstackwatch. Openstackwatch is configured to store feed data in a swift object store. This patch adds credentials to access that swift store. Change-Id: I61d9032150ae40fb7d207b5861cf0cf448f6feda Reviewed-on: https://review.openstack.org/24784 Reviewed-by: Elizabeth Krumbach Reviewed-by: Jeremy Stanley Approved: Monty Taylor Reviewed-by: Monty Taylor Tested-by: Jenkins --- manifests/site.pp | 2 ++ modules/jeepyb/manifests/openstackwatch.pp | 28 +++++++++++-------- .../jeepyb/templates/openstackwatch.ini.erb | 10 +++---- modules/openstack_project/manifests/gerrit.pp | 16 +++++++---- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/manifests/site.pp b/manifests/site.pp index c14e62ad2a..2bab6084b2 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -37,6 +37,8 @@ node 'review.openstack.org' { contactstore_appsec => hiera('gerrit_contactstore_appsec'), contactstore_pubkey => hiera('gerrit_contactstore_pubkey'), sysadmins => hiera('sysadmins'), + swift_username => hiera('swift_store_user'), + swift_password => hiera('swift_store_key'), } } diff --git a/modules/jeepyb/manifests/openstackwatch.pp b/modules/jeepyb/manifests/openstackwatch.pp index 48ef0dddcc..feed6bc198 100644 --- a/modules/jeepyb/manifests/openstackwatch.pp +++ b/modules/jeepyb/manifests/openstackwatch.pp @@ -1,6 +1,10 @@ # == Class: jeepyb::openstackwatch class jeepyb::openstackwatch( + $swift_username = '', + $swift_password = '', + $swift_auth_url = '', + $auth_version = '', $projects = [], $mode = 'multiple', $container = 'rss', @@ -24,17 +28,19 @@ class jeepyb::openstackwatch( require => Group['openstackwatch'], } - cron { 'openstackwatch': - ensure => present, - command => '/usr/local/bin/openstackwatch /home/openstackwatch/openstackwatch.ini', - minute => $minute, - hour => $hour, - user => 'openstackwatch', - require => [ - File['/home/openstackwatch/openstackwatch.ini'], - User['openstackwatch'], - Class['jeepyb'], - ], + if $swift_password != '' { + cron { 'openstackwatch': + ensure => present, + command => '/usr/local/bin/openstackwatch /home/openstackwatch/openstackwatch.ini', + minute => $minute, + hour => $hour, + user => 'openstackwatch', + require => [ + File['/home/openstackwatch/openstackwatch.ini'], + User['openstackwatch'], + Class['jeepyb'], + ], + } } file { '/home/openstackwatch/openstackwatch.ini': diff --git a/modules/jeepyb/templates/openstackwatch.ini.erb b/modules/jeepyb/templates/openstackwatch.ini.erb index 0d5203f73d..0b10a44483 100644 --- a/modules/jeepyb/templates/openstackwatch.ini.erb +++ b/modules/jeepyb/templates/openstackwatch.ini.erb @@ -16,10 +16,10 @@ mode = <%= mode %> [swift] # username/tenant for swift with 2.0 or just username with 1.0 (i.e: # RAX). -# username = +username = <%= swift_username %> -# passowrd or api key -# password = +# password or api key +password = <%= swift_password %> # container to upload (probably want to be public) container = <%= container %> @@ -28,10 +28,10 @@ container = <%= container %> # https://auth.api.rackspacecloud.com/v1.0 # or Rackspace UK : # https://lon.auth.api.rackspacecloud.com/v1.0 -# auth_url = https://lon.auth.api.rackspacecloud.com/v1.0 +auth_url = <%= swift_auth_url %> # auth version (1.0 for Rackspace clouds, 2.0 for keystone backend clusters) -# auth_version = 1.0 +auth_version = <%= auth_version %> # the object name where to store the combined rss uploaded_file = <%= feed %> diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index aa34d7b407..4a6b3f928b 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -57,7 +57,9 @@ class openstack_project::gerrit ( $cla_id = '2', $cla_name = 'ICLA', $testmode = false, - $sysadmins = [] + $sysadmins = [], + $swift_username = '', + $swift_password = '', ) { class { 'openstack_project::server': iptables_public_tcp_ports => [80, 443, 29418], @@ -65,14 +67,18 @@ class openstack_project::gerrit ( } class { 'jeepyb::openstackwatch': - projects => [ + projects => [ 'openstack/cinder', 'openstack/keystone', 'openstack-dev/devstack', ], - container => 'rss', - feed => 'openstackwatch.xml', - json_url => 'https://review.openstack.org/query?q=status:open', + container => 'rss', + feed => 'openstackwatch.xml', + json_url => 'https://review.openstack.org/query?q=status:open', + swift_username => $swift_username, + swift_password => $swift_password, + swift_auth_url => 'https://auth.api.rackspacecloud.com/v1.0', + auth_version => '1.0', } class { '::gerrit':