Consolidate config into single file

Upstream commits [1,2] modified heat to use a single config file.
This modifies the puppet config of each component to use different
sections of the same file.

Some notes about the change:

 - each of heat-api, heat-api-cfn, heat-api-cloudwatch has indvidual
   options for bind_port, bind_host
 - heat-engine options live under DEFAULT (it does not bind to any
   ports)
 - new log_dir global
 - slight fixes to ENCRYPTION_KEY generation for new heat.conf name
 - include rspec tests for api-cfn & api-cloudwatch

Fixes bug 1214824

[1] https://review.openstack.org/#/c/39980/
[2] https://review.openstack.org/#/c/43697/

Change-Id: I7d8865a809da71696b944ab0654a1f728cd827df
This commit is contained in:
Ian Wienand 2013-08-23 16:19:22 +10:00
parent ceee58426a
commit 84dbad08b7
9 changed files with 136 additions and 114 deletions

View File

@ -15,14 +15,14 @@ node default {
class { 'heat::db':
}
# Common class
class { 'heat': }
class { 'heat':
# The keystone_password parameter is mandatory
keystone_password => 'password'
}
# class { 'heat::params': }
# Install the heat-api service
# The keystone_password parameter is mandatory
class { 'heat::api':
keystone_password => 'password'
}
class { 'heat::api': }
# Install heat-engine
class { 'heat::engine':

View File

@ -2,24 +2,13 @@
class heat::api (
$enabled = true,
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_protocol = 'http',
$keystone_user = 'heat',
$keystone_tenant = 'services',
$keystone_password = false,
$keystone_ec2_uri = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$auth_uri = 'http://127.0.0.1:5000/v2.0',
$bind_host = '0.0.0.0',
$bind_port = '8004',
$verbose = false,
$debug = false,
) {
include heat
include heat::params
validate_string($keystone_password)
Heat_config<||> ~> Service['heat-api']
Package['heat-api'] -> Heat_config<||>
@ -48,18 +37,7 @@ class heat::api (
}
heat_config {
'DEFAULT/debug' : value => $debug;
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/log_dir' : value => $::heat::params::log_dir;
'DEFAULT/bind_host' : value => $bind_host;
'DEFAULT/bind_port' : value => $bind_port;
'ec2authtoken/keystone_ec2_uri' : value => $keystone_ec2_uri;
'ec2authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/auth_host' : value => $keystone_host;
'keystone_authtoken/auth_port' : value => $keystone_port;
'keystone_authtoken/auth_protocol' : value => $keystone_protocol;
'keystone_authtoken/admin_tenant_name' : value => $keystone_tenant;
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password;
'heat_api/bind_host' : value => $bind_host;
'heat_api/bind_port' : value => $bind_port;
}
}

View File

@ -1,25 +1,14 @@
# Installs & configure the heat CloudFormation API service
#
class heat::api_cfn (
$enabled = true,
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_protocol = 'http',
$keystone_user = 'heat',
$keystone_tenant = 'services',
$keystone_password = false,
$keystone_ec2_uri = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$auth_uri = 'http://127.0.0.1:5000/v2.0',
$bind_host = '0.0.0.0',
$bind_port = '8000',
$verbose = false,
$debug = false,
) {
include heat
include heat::params
validate_string($keystone_password)
Heat_config<||> ~> Service['heat-api-cfn']
Package['heat-api-cfn'] -> Heat_config<||>
@ -47,18 +36,7 @@ class heat::api_cfn (
}
heat_config {
'DEFAULT/debug' : value => $debug;
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/log_dir' : value => $::heat::params::log_dir;
'DEFAULT/bind_host' : value => $bind_host;
'DEFAULT/bind_port' : value => $bind_port;
'ec2authtoken/keystone_ec2_uri' : value => $keystone_ec2_uri;
'ec2authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/auth_host' : value => $keystone_host;
'keystone_authtoken/auth_port' : value => $keystone_port;
'keystone_authtoken/auth_protocol' : value => $keystone_protocol;
'keystone_authtoken/admin_tenant_name' : value => $keystone_tenant;
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password;
'heat_api_cfn/bind_host' : value => $bind_host;
'heat_api_cfn/bind_port' : value => $bind_port;
}
}

View File

@ -1,25 +1,14 @@
# Installs & configure the heat CloudWatch API service
#
class heat::api_cloudwatch (
$enabled = true,
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_protocol = 'http',
$keystone_user = 'heat',
$keystone_tenant = 'services',
$keystone_password = false,
$keystone_ec2_uri = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$auth_uri = 'http://127.0.0.1:5000/v2.0',
$bind_host = '0.0.0.0',
$bind_port = '8003',
$verbose = false,
$debug = false,
) {
include heat
include heat::params
validate_string($keystone_password)
Heat_config<||> ~> Service['heat-api-cloudwatch']
Package['heat-api-cloudwatch'] -> Heat_config<||>
@ -47,18 +36,7 @@ class heat::api_cloudwatch (
}
heat_config {
'DEFAULT/debug' : value => $debug;
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/log_dir' : value => $::heat::params::log_dir;
'DEFAULT/bind_host' : value => $bind_host;
'DEFAULT/bind_port' : value => $bind_port;
'ec2authtoken/keystone_ec2_uri' : value => $keystone_ec2_uri;
'ec2authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/auth_host' : value => $keystone_host;
'keystone_authtoken/auth_port' : value => $keystone_port;
'keystone_authtoken/auth_protocol' : value => $keystone_protocol;
'keystone_authtoken/admin_tenant_name' : value => $keystone_tenant;
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password;
'heat_api_cloudwatch/bind_host' : value => $bind_host;
'heat_api_cloudwatch/bind_port' : value => $bind_port;
}
}

View File

@ -1,17 +1,7 @@
# Installs & configure the heat engine service
class heat::engine (
$enabled = true,
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_protocol = 'http',
$keystone_user = 'heat',
$keystone_tenant = 'services',
$keystone_password = 'password',
$bind_host = '0.0.0.0',
$bind_port = '8001',
$verbose = false,
$debug = false,
$enabled = true,
$heat_stack_user_role = 'heat_stack_user',
$heat_metadata_server_url = 'http://127.0.0.1:8000',
$heat_waitcondition_server_url = 'http://127.0.0.1:8000/v1/waitcondition',
@ -20,8 +10,6 @@ class heat::engine (
include heat::params
validate_string($keystone_password)
Heat_config<||> ~> Service['heat-engine']
Package['heat-engine'] -> Heat_config<||>
@ -31,12 +19,6 @@ class heat::engine (
name => $::heat::params::engine_package_name,
}
file { '/etc/heat/heat-engine.conf':
owner => 'heat',
group => 'heat',
mode => '0640',
}
if $enabled {
$service_ensure = 'running'
} else {
@ -49,7 +31,7 @@ class heat::engine (
enable => $enabled,
hasstatus => true,
hasrestart => true,
require => [ File['/etc/heat/heat-engine.conf'],
require => [ File['/etc/heat/heat.conf'],
Exec['heat-encryption-key-replacement'],
Package['heat-common'],
Package['heat-engine'],
@ -57,17 +39,14 @@ class heat::engine (
}
exec {'heat-encryption-key-replacement':
command => 'sed -i "s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e \'/1 "%02x"\' /dev/random`/" /etc/heat/heat-engine.conf',
command => 'sed -i".bak" "s/%ENCRYPTION_KEY%/`hexdump -n 16 -v -e \'/1 "%02x"\' /dev/random`/" /etc/heat/heat.conf',
path => [ '/usr/bin', '/bin'],
onlyif => 'grep -c ENCRYPTION_KEY /etc/heat/heat-engine.conf',
}
onlyif => 'grep -c %ENCRYPTION_KEY% /etc/heat/heat.conf',
require => File['/etc/heat/heat.conf'],
}
heat_config {
'DEFAULT/debug' : value => $debug;
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/log_dir' : value => $::heat::params::log_dir;
'DEFAULT/bind_host' : value => $bind_host;
'DEFAULT/bind_port' : value => $bind_port;
'DEFAULT/auth_encryption_key' : value => '%ENCRYPTION_KEY%'; # replaced above
'DEFAULT/heat_stack_user_role' : value => $heat_stack_user_role;
'DEFAULT/heat_metadata_server_url' : value => $heat_metadata_server_url;
'DEFAULT/heat_waitcondition_server_url': value => $heat_waitcondition_server_url;

View File

@ -9,6 +9,8 @@
# should the daemons log verbose messages. Optional. Defaults to 'False'
# [*debug*]
# should the daemons log debug messages. Optional. Defaults to 'False'
# [*log_dir*]
# Directory where logs should be stored. Optional. Defaults to '/var/log/heat'.
# [*rabbit_host*]
# ip or hostname of the rabbit server. Optional. Defaults to '127.0.0.1'
# [*rabbit_port*]
@ -22,6 +24,17 @@
# password to connect to the rabbit_server. Optional. Defaults to empty.
# [*rabbit_virtualhost*]
# virtualhost to use. Optional. Defaults to '/'
#
# (keystone authentication options)
# [*keystone_host*]
# [*keystone_port*]
# [*keystone_protocol*]
# [*keystone_user*]
# [*keystone_tenant*]
# [*keystone_password*]
# [*keystone_ec2_uri*]
#
# (optional) various QPID options
# [*qpid_hostname*]
# [*qpid_port*]
# [*qpid_username*]
@ -35,13 +48,21 @@
# [*qpid_reconnect_interval*]
# [*qpid_reconnect_interval_min*]
# [*qpid_reconnect_interval_max*]
# (optional) various QPID options
#
class heat(
$auth_uri = 'http://127.0.0.1:5000/v2.0',
$package_ensure = 'present',
$verbose = false,
$debug = false,
$log_dir = '/var/log/heat',
$keystone_host = '127.0.0.1',
$keystone_port = '35357',
$keystone_protocol = 'http',
$keystone_user = 'heat',
$keystone_tenant = 'services',
$keystone_password = false,
$keystone_ec2_uri = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$rpc_backend = 'heat.openstack.common.rpc.impl_kombu',
$rabbit_host = '127.0.0.1',
$rabbit_port = 5672,
@ -153,9 +174,19 @@ class heat(
}
heat_config {
'DEFAULT/rpc_backend' : value => $rpc_backend;
'DEFAULT/debug' : value => $debug;
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/rpc_backend' : value => $rpc_backend;
'DEFAULT/debug' : value => $debug;
'DEFAULT/verbose' : value => $verbose;
'DEFAULT/log_dir' : value => $log_dir;
'ec2authtoken/keystone_ec2_uri' : value => $keystone_ec2_uri;
'ec2authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/auth_uri' : value => $auth_uri;
'keystone_authtoken/auth_host' : value => $keystone_host;
'keystone_authtoken/auth_port' : value => $keystone_port;
'keystone_authtoken/auth_protocol' : value => $keystone_protocol;
'keystone_authtoken/admin_tenant_name' : value => $keystone_tenant;
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password;
}
}

View File

@ -0,0 +1,26 @@
require 'spec_helper'
describe 'heat::api_cfn' do
let :params do
{
:bind_host => '127.0.0.1',
:bind_port => '1234'
}
end
let :facts do
{ :osfamily => 'Debian' }
end
context 'config params' do
it { should include_class('heat') }
it { should include_class('heat::params') }
it { should contain_heat_config('heat_api_cfn/bind_host').with_value( params[:bind_host] ) }
it { should contain_heat_config('heat_api_cfn/bind_port').with_value( params[:bind_port] ) }
end
end

View File

@ -0,0 +1,26 @@
require 'spec_helper'
describe 'heat::api_cloudwatch' do
let :params do
{
:bind_host => '127.0.0.1',
:bind_port => '1234'
}
end
let :facts do
{ :osfamily => 'Debian' }
end
context 'config params' do
it { should include_class('heat') }
it { should include_class('heat::params') }
it { should contain_heat_config('heat_api_cloudwatch/bind_host').with_value( params[:bind_host] ) }
it { should contain_heat_config('heat_api_cloudwatch/bind_port').with_value( params[:bind_port] ) }
end
end

View File

@ -0,0 +1,26 @@
require 'spec_helper'
describe 'heat::api' do
let :params do
{
:bind_host => '127.0.0.1',
:bind_port => '1234'
}
end
let :facts do
{ :osfamily => 'Debian' }
end
context 'config params' do
it { should include_class('heat') }
it { should include_class('heat::params') }
it { should contain_heat_config('heat_api/bind_host').with_value( params[:bind_host] ) }
it { should contain_heat_config('heat_api/bind_port').with_value( params[:bind_port] ) }
end
end