Fixes to nodepool installation on jenkins-dev.o.o

The patch to add nodepool to jenkins-dev (https://review.openstack.org/#/c/57333)
did not work.

There were a few issues with it:
  1. jenkins-dev.pp was passing literal strings to the nodepool module, instead it
     should be passing in the variables.
  2. jenkins-dev.pp was calling ::nodepool but puppet seems to think that it wants
     ::openstack_project::nodepool due to puppet's scoping weirdness :(
  3. The script to build nodepool machines needed the jenkins_dev_ssh_key.

Fixes to above issues:
  1. This is trivial, just passed the variables thru instead of literal strings.
  2. The nodepool.pp module is renamed to nodepool_prod.pp to prevent the scoping problem.
  3. We use the dev jenkins ssh key with dev nodepool by allowing the nodepool module
     to pass arbitrary env settings through the defaults file.

Change-Id: Id91053212f088079ff1b0f06ebdce5c381f5cd19
This commit is contained in:
James E. Blair 2014-04-16 09:50:14 -07:00 committed by Khai Do
parent 9de8df3508
commit 398e1175f4
5 changed files with 40 additions and 17 deletions

View File

@ -398,7 +398,7 @@ node 'status.openstack.org' {
}
node 'nodepool.openstack.org' {
class { 'openstack_project::nodepool':
class { 'openstack_project::nodepool_prod':
mysql_password => hiera('nodepool_mysql_password'),
mysql_root_password => hiera('nodepool_mysql_root_password'),
nodepool_ssh_private_key => hiera('jenkins_ssh_private_key_contents'),

View File

@ -27,6 +27,7 @@ class nodepool (
$vhost_name = 'nodepool.openstack.org',
$image_log_document_root = '/var/log/nodepool/image',
$enable_image_log_via_http = false,
$environment = {},
) {
class { 'mysql::server':

View File

@ -1,6 +1,8 @@
<% if scope.lookupvar("nodepool::statsd_host") != "" %>
<% if scope.lookupvar("nodepool::statsd_host") != "" -%>
export STATSD_HOST=<%= scope.lookupvar("nodepool::statsd_host") %>
export STATSD_PORT=8125
<% end %>
<% end -%>
<% scope.lookupvar("nodepool::environment").keys.sort.each do |key| -%>
export <%= key %>='<%= scope.lookupvar("nodepool::environment")[key] %>'
<% end -%>
DAEMON_ARGS="-c /etc/nodepool/nodepool.yaml -l /etc/nodepool/logging.conf"

View File

@ -12,6 +12,7 @@ class openstack_project::jenkins_dev (
$hpcloud_username ='',
$hpcloud_password ='',
$hpcloud_project ='',
$nodepool_template ='nodepool-dev.yaml.erb',
) {
include openstack_project
@ -44,17 +45,36 @@ class openstack_project::jenkins_dev (
}
class { '::nodepool':
mysql_password => 'mysql_password',
mysql_root_password => 'mysql_root_password',
nodepool_ssh_private_key => 'nodepool_ssh_private_key',
nodepool_template => 'nodepool-dev.yaml.erb',
sysadmins => 'sysadmins',
jenkins_api_user => 'jenkins_api_user',
jenkins_api_key => 'jenkins_api_key',
jenkins_credentials_id => 'jenkins_credentials_id',
hpcloud_username => 'hpcloud_username',
hpcloud_password => 'hpcloud_password',
hpcloud_project => 'hpcloud_project',
mysql_root_password => $mysql_root_password,
mysql_password => $mysql_password,
nodepool_ssh_private_key => $nodepool_ssh_private_key,
environment => {
'NODEPOOL_SSH_KEY' => $openstack_project::jenkins_dev_ssh_key,
}
}
file { '/etc/nodepool/nodepool.yaml':
ensure => present,
owner => 'nodepool',
group => 'root',
mode => '0400',
content => template("openstack_project/nodepool/${nodepool_template}"),
require => [
File['/etc/nodepool'],
User['nodepool'],
],
}
file { '/etc/nodepool/scripts':
ensure => directory,
owner => 'root',
group => 'root',
mode => '0755',
recurse => true,
purge => true,
force => true,
require => File['/etc/nodepool'],
source => 'puppet:///modules/openstack_project/nodepool/scripts',
}
}

View File

@ -1,6 +1,6 @@
# == Class: openstack_project::nodepool
# == Class: openstack_project::nodepool_prod
#
class openstack_project::nodepool(
class openstack_project::nodepool_prod(
$mysql_root_password,
$mysql_password,
$nodepool_ssh_private_key = '',