Move Heat to authtoken

Switch keystone_authtoken parameters for the new class
heat::keystone::authtoken to configure the keystone_authtoken section
in heat.conf.

Some deprecations:
- heat::auth_uri is deprecated in favor of
  heat::keystone::authtoken::auth_uri.
- heat::identity_uri is deprecated in favor of
  heat::keystone::authtoken::auth_url.
- heat::auth_plugin is deprecated in favor of
  heat::keystone::authtoken::auth_type.
- heat::keystone_user is deprecated in favor of
  heat::keystone::authtoken::username.
- heat::keystone_tenant is deprecated in favor of
  heat::keystone::authtoken::project_name.
- heat::keystone_password is deprecated in favor of
  heat::keystone::authtoken::password.
- heat::keystone_user_domain_name is deprecated in favor of
  heat::keystone::authtoken::user_domain_name.
- heat::keystone_user_domain_id is deprecated, use the name option.
- heat::keystone_project_domain_name is deprecated in favor of
  heat::keystone::authtoken::project_domain_name.
- heat::keystone_project_domain_id is deprecated, use the name option.
- heat::memcached_servers is deprecated in favor of
  heat::keystone::authtoken::memcached_servers.

Change-Id: I466558e98176f20743271191df64dc327f0efcc6
Closes-bug: #1604463
This commit is contained in:
Iury Gregory Melo Ferreira 2016-08-23 22:51:13 -03:00
parent d364553b70
commit 85b55571b8
13 changed files with 625 additions and 132 deletions

View File

@ -11,10 +11,11 @@ node default {
password => 'heat',
}
class { '::heat::keystone::authtoken':
password => 'password',
}
# Common class
class { '::heat':
# The keystone_password parameter is mandatory
keystone_password => 'password',
sql_connection => 'mysql+pymysql://heat:heat@localhost/heat'
}

View File

@ -18,10 +18,10 @@
# Defaults to undef.
#
# [*default_transport_url*]
# (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default
# (optional) A URL representing the messaging driver to use and its full
# configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default
#
# [*rpc_backend*]
# (Optional) Use these options to configure the message system.
@ -202,52 +202,8 @@
# Value can be a string or a list.
# Defaults to $::os_service_default
#
# == keystone authentication options
#
# [*auth_uri*]
# (Optional) Specifies the public Identity URI for Heat to use.
# Located in heat.conf.
# Defaults to: 'http://127.0.0.1:5000/'.
#
# [*identity_uri*]
# (Optional) Specifies the admin Identity URI for Heat to use.
# Located in heat.conf.
# Defaults to: 'http://127.0.0.1:35357/'.
#
# [*auth_plugin*]
# Specifies the plugin used for authentication.
# Defaults to undef.
#
# [*keystone_user*]
# Defaults to 'heat'.
#
# [*keystone_tenant*]
# Defaults to 'services'.
#
# [*keystone_password*]
#
# [*keystone_project_domain_name*]
# Specifies the project domain of Keystone account for "password" auth_plugin.
# Defaults to 'Default'.
#
# [*keystone_user_domain_id*]
# (Optional) Domain ID of the principal if the principal has a domain.
# Defaults to: $::os_service_default.
#
# [*keystone_user_domain_name*]
# Defaults to 'Default'.
#
# [*keystone_project_domain_id*]
# (Optional) Domain ID of the scoped project if auth is project-scoped.
# Defaults to: $::os_service_default.
#
# [*keystone_ec2_uri*]
#
# [*memcached_servers*]
# (optinal) a list of memcached server(s) to use for caching. If left
# undefined, tokens will instead be cached in-process.
# Defaults to $::os_service_default.
#
# [*database_connection*]
# (optional) Connection url for the heat database.
# Defaults to undef.
@ -325,28 +281,67 @@
# in the heat config.
# Defaults to false.
#
# [*auth_strategy*]
# (optional) Type of authentication to use
# Defaults to 'keystone'
#
# DEPRECATED PARAMETERS
#
# [*verbose*]
# (Optional) Deprecated. Should the daemons log verbose messages
# Defaults to undef.
#
# [*auth_uri*]
# (Optional) Deprecated. Use heat::keystone::authtoken::auth_uri
# Defaults to undef
#
# [*identity_uri*]
# (Optional) Deprecated. Use heat::keystone::authtoken::auth_url
# Defaults to undef
#
# [*auth_plugin*]
# (Optional) Deprecated. Use heat::keystone::authtoken::auth_type
# Defaults to undef
#
# [*keystone_user*]
# (Optional) Deprecated. Use heat::keystone::authtoken::username
# Defaults to undef
#
# [*keystone_tenant*]
# (Optional) Deprecated. Use heat::keystone::authtoken::
# Defaults to undef
#
# [*keystone_password*]
# (Optional) Deprecated. Use heat::keystone::authtoken::password
# Defaults to undef
#
# [*keystone_user_domain_name*]
# (Optional) Deprecated. Use heat::keystone::authtoken::user_domain_name
# Defaults to undef
#
# [*keystone_user_domain_id*]
# (Optional) Deprecated. Use heat::keystone::authtoken::user_domain_name
# instead, there is no need for both id and name options.
# Defaults to $::os_service_default
#
# [*keystone_project_domain_name*]
# (Optional) Deprecated. Use heat::keystone::authtoken::project_domain_name
# Defaults to undef
#
# [*keystone_project_domain_id*]
# (Optional) Deprecated. Use heat::keystone::authtoken::project_domain_name
# instead, there is no need for both id and name options.
# Defaults to $::os_service_default
#
# [*memcached_servers*]
# (Optional) Deprecated. Use heat::keystone::authtoken::memcached_servers.
# Defaults to undef
#
class heat(
$auth_uri = 'http://127.0.0.1:5000/',
$identity_uri = 'http://127.0.0.1:35357/',
$package_ensure = 'present',
$debug = undef,
$log_dir = undef,
$auth_plugin = undef,
$keystone_user = 'heat',
$keystone_tenant = 'services',
$keystone_password = false,
$keystone_ec2_uri = 'http://127.0.0.1:5000/v2.0/ec2tokens',
$keystone_project_domain_id = $::os_service_default,
$keystone_project_domain_name = 'Default',
$keystone_user_domain_id = $::os_service_default,
$keystone_user_domain_name = 'Default',
$memcached_servers = $::os_service_default,
$default_transport_url = $::os_service_default,
$rpc_backend = $::os_service_default,
$rpc_response_timeout = $::os_service_default,
@ -406,8 +401,20 @@ class heat(
$enable_proxy_headers_parsing = $::os_service_default,
$heat_clients_url = $::os_service_default,
$purge_config = false,
$auth_strategy = 'keystone',
# Deprecated
$verbose = undef,
$auth_uri = undef,
$identity_uri = undef,
$auth_plugin = undef,
$keystone_user = undef,
$keystone_tenant = undef,
$keystone_password = undef,
$keystone_user_domain_name = undef,
$keystone_user_domain_id = $::os_service_default,
$keystone_project_domain_name = undef,
$keystone_project_domain_id = $::os_service_default,
$memcached_servers = undef,
) {
include ::heat::logging
@ -415,10 +422,58 @@ class heat(
include ::heat::deps
include ::heat::params
if $auth_strategy == 'keystone' {
include ::heat::keystone::authtoken
}
if $verbose {
warning('verbose is deprecated, has no effect and will be removed after Newton cycle.')
}
if $auth_uri {
warning('auth_uri is deprecated, use heat::keystone::authtoken::auth_uri instead.')
}
if $identity_uri {
warning('identity_uri is deprecated, use heat::keystone::authtoken::auth_url instead.')
}
if $auth_plugin {
warning('auth_plugin is deprecated, use heat::keystone::authtoken::auth_type instead.')
}
if $keystone_user {
warning('keystone_user is deprecated, use heat::keystone::authtoken::username instead.')
}
if $keystone_tenant {
warning('keystone_tenant is deprecated, use heat::keystone::authtoken::project_name instead.')
}
if $keystone_password {
warning('keystone_password is deprecated, use heat::keystone::authtoken::password instead.')
}
if $keystone_user_domain_name {
warning('keystone_user_domain_name is deprecated, use heat::keystone::authtoken::user_domain_name instead.')
}
if $keystone_user_domain_id {
warning('keystone_user_domain_id is deprecated, use the name option instead.')
}
if $keystone_project_domain_name {
warning('keystone_project_domain_name is deprecated, use heat::keystone::authtoken::project_domain_name instead.')
}
if $keystone_project_domain_id {
warning('keystone_project_domain_id is deprecated, use the name option instead.')
}
if $memcached_servers {
warning('memcached_servers is deprecated, use heat::keystone::authtoken::memcached_servers instead.')
}
package { 'heat-common':
ensure => $package_ensure,
name => $::heat::params::common_package_name,
@ -476,45 +531,24 @@ class heat(
}
}
if $auth_plugin {
if $auth_plugin == 'password' {
heat_config {
'keystone_authtoken/auth_url': value => $identity_uri;
'keystone_authtoken/auth_plugin': value => $auth_plugin;
'keystone_authtoken/username': value => $keystone_user;
'keystone_authtoken/password': value => $keystone_password, secret => true;
'keystone_authtoken/user_domain_id': value => $keystone_user_domain_id;
'keystone_authtoken/user_domain_name': value => $keystone_user_domain_name;
'keystone_authtoken/project_name': value => $keystone_tenant;
'keystone_authtoken/project_domain_id': value => $keystone_project_domain_id;
'keystone_authtoken/project_domain_name': value => $keystone_project_domain_name;
}
} else {
fail('Currently only "password" auth_plugin is supported.')
}
} else {
warning('"admin_user", "admin_password", "admin_tenant_name" configuration options are deprecated in favor of auth_plugin and related options')
heat_config {
'keystone_authtoken/auth_uri': value => $auth_uri;
'keystone_authtoken/identity_uri': value => $identity_uri;
'keystone_authtoken/admin_tenant_name': value => $keystone_tenant;
'keystone_authtoken/admin_user': value => $keystone_user;
'keystone_authtoken/admin_password': value => $keystone_password, secret => true;
}
}
$auth_url_real = pick($identity_uri, $::heat::keystone::authtoken::auth_url)
$auth_uri_real = pick($identity_uri, $::heat::keystone::authtoken::auth_uri)
$keystone_user_real = pick($keystone_user, $::heat::keystone::authtoken::username)
$keystone_password_real = pick($keystone_password, $::heat::keystone::authtoken::password)
$keystone_project_domain_name_real = pick($keystone_project_domain_name, $::heat::keystone::authtoken::project_domain_name)
$keystone_user_domain_name_real = pick($keystone_user_domain_name, $::heat::keystone::authtoken::user_domain_name)
heat_config {
'trustee/auth_plugin': value => 'password';
'trustee/auth_url': value => $identity_uri;
'trustee/username': value => $keystone_user;
'trustee/password': value => $keystone_password, secret => true;
'trustee/auth_url': value => $auth_url_real;
'trustee/username': value => $keystone_user_real;
'trustee/password': value => $keystone_password_real, secret => true;
'trustee/project_domain_id': value => $keystone_project_domain_id;
'trustee/user_domain_id': value => $keystone_user_domain_id;
'trustee/project_domain_name': value => $keystone_project_domain_name;
'trustee/user_domain_name': value => $keystone_user_domain_name;
'clients_keystone/auth_uri': value => $identity_uri;
'clients_heat/url': value => $heat_clients_url;
'trustee/project_domain_name': value => $keystone_project_domain_name_real;
'trustee/user_domain_name': value => $keystone_user_domain_name_real;
'clients_keystone/auth_uri': value => $auth_uri_real;
'clients_heat/url': value => $heat_clients_url;
}
if (!is_service_default($enable_stack_adopt)) {
@ -533,7 +567,6 @@ class heat(
'DEFAULT/enable_stack_adopt': value => $enable_stack_adopt;
'ec2authtoken/auth_uri': value => $keystone_ec2_uri;
'paste_deploy/flavor': value => $flavor;
'keystone_authtoken/memcached_servers': value => join(any2array($memcached_servers), ',');
}
oslo::messaging::notifications { 'heat_config':

View File

@ -0,0 +1,277 @@
# class: heat::keystone::authtoken
#
# Configure the keystone_authtoken section in the configuration file
#
# === Parameters
#
# [*username*]
# (Optional) The name of the service user
# Defaults to 'heat'
#
# [*password*]
# (Optional) Password to create for the service user
# Defaults to $::os_service_default
#
# [*auth_url*]
# (Optional) The URL to use for authentication.
# Defaults to 'http://127.0.0.1:35357/'
#
# [*project_name*]
# (Optional) Service project name
# Defaults to 'services'
#
# [*user_domain_name*]
# (Optional) Name of domain for $username
# Defaults to 'Default'
#
# [*project_domain_name*]
# (Optional) Name of domain for $project_name
# Defaults to 'Default'
#
# [*insecure*]
# (Optional) If true, explicitly allow TLS without checking server cert
# against any certificate authorities. WARNING: not recommended. Use with
# caution.
# Defaults to $:os_service_default
#
# [*auth_section*]
# (Optional) Config Section from which to load plugin specific options
# Defaults to $::os_service_default.
#
# [*auth_type*]
# (Optional) Authentication type to load
# Defaults to 'password'
#
# [*auth_uri*]
# (Optional) Complete public Identity API endpoint.
# Defaults to 'http://127.0.0.1:5000/'
#
# [*auth_version*]
# (Optional) API version of the admin Identity API endpoint.
# Defaults to $::os_service_default.
#
# [*cache*]
# (Optional) Env key for the swift cache.
# Defaults to $::os_service_default.
#
# [*cafile*]
# (Optional) A PEM encoded Certificate Authority to use when verifying HTTPs
# connections.
# Defaults to $::os_service_default.
#
# [*certfile*]
# (Optional) Required if identity server requires client certificate
# Defaults to $::os_service_default.
#
# [*check_revocations_for_cached*]
# (Optional) If true, the revocation list will be checked for cached tokens.
# This requires that PKI tokens are configured on the identity server.
# boolean value.
# Defaults to $::os_service_default.
#
# [*delay_auth_decision*]
# (Optional) Do not handle authorization requests within the middleware, but
# delegate the authorization decision to downstream WSGI components. Boolean
# value
# Defaults to $::os_service_default.
#
# [*enforce_token_bind*]
# (Optional) Used to control the use and type of token binding. Can be set
# to: "disabled" to not check token binding. "permissive" (default) to
# validate binding information if the bind type is of a form known to the
# server and ignore it if not. "strict" like "permissive" but if the bind
# type is unknown the token will be rejected. "required" any form of token
# binding is needed to be allowed. Finally the name of a binding method that
# must be present in tokens. String value.
# Defaults to $::os_service_default.
#
# [*hash_algorithms*]
# (Optional) Hash algorithms to use for hashing PKI tokens. This may be a
# single algorithm or multiple. The algorithms are those supported by Python
# standard hashlib.new(). The hashes will be tried in the order given, so put
# the preferred one first for performance. The result of the first hash will
# be stored in the cache. This will typically be set to multiple values only
# while migrating from a less secure algorithm to a more secure one. Once all
# the old tokens are expired this option should be set to a single value for
# better performance. List value.
# Defaults to $::os_service_default.
#
# [*http_connect_timeout*]
# (Optional) Request timeout value for communicating with Identity API
# server.
# Defaults to $::os_service_default.
#
# [*http_request_max_retries*]
# (Optional) How many times are we trying to reconnect when communicating
# with Identity API Server. Integer value
# Defaults to $::os_service_default.
#
# [*include_service_catalog*]
# (Optional) Indicate whether to set the X-Service-Catalog header. If False,
# middleware will not ask for service catalog on token validation and will
# not set the X-Service-Catalog header. Boolean value.
# Defaults to $::os_service_default.
#
# [*keyfile*]
# (Optional) Required if identity server requires client certificate
# Defaults to $::os_service_default.
#
# [*memcache_pool_conn_get_timeout*]
# (Optional) Number of seconds that an operation will wait to get a memcached
# client connection from the pool. Integer value
# Defaults to $::os_service_default.
#
# [*memcache_pool_dead_retry*]
# (Optional) Number of seconds memcached server is considered dead before it
# is tried again. Integer value
# Defaults to $::os_service_default.
#
# [*memcache_pool_maxsize*]
# (Optional) Maximum total number of open connections to every memcached
# server. Integer value
# Defaults to $::os_service_default.
#
# [*memcache_pool_socket_timeout*]
# (Optional) Number of seconds a connection to memcached is held unused in
# the pool before it is closed. Integer value
# Defaults to $::os_service_default.
#
# [*memcache_pool_unused_timeout*]
# (Optional) Number of seconds a connection to memcached is held unused in
# the pool before it is closed. Integer value
# Defaults to $::os_service_default.
#
# [*memcache_secret_key*]
# (Optional, mandatory if memcache_security_strategy is defined) This string
# is used for key derivation.
# Defaults to $::os_service_default.
#
# [*memcache_security_strategy*]
# (Optional) If defined, indicate whether token data should be authenticated
# or authenticated and encrypted. If MAC, token data is authenticated (with
# HMAC) in the cache. If ENCRYPT, token data is encrypted and authenticated in the
# cache. If the value is not one of these options or empty, auth_token will
# raise an exception on initialization.
# Defaults to $::os_service_default.
#
# [*memcache_use_advanced_pool*]
# (Optional) Use the advanced (eventlet safe) memcached client pool. The
# advanced pool will only work under python 2.x Boolean value
# Defaults to $::os_service_default.
#
# [*memcached_servers*]
# (Optional) Optionally specify a list of memcached server(s) to use for
# caching. If left undefined, tokens will instead be cached in-process.
# Defaults to $::os_service_default.
#
# [*region_name*]
# (Optional) The region in which the identity server can be found.
# Defaults to $::os_service_default.
#
# [*revocation_cache_time*]
# (Optional) Determines the frequency at which the list of revoked tokens is
# retrieved from the Identity service (in seconds). A high number of
# revocation events combined with a low cache duration may significantly
# reduce performance. Only valid for PKI tokens. Integer value
# Defaults to $::os_service_default.
#
# [*signing_dir*]
# (Optional) Directory used to cache files related to PKI tokens.
# Defaults to $::os_service_default.
#
# [*token_cache_time*]
# (Optional) In order to prevent excessive effort spent validating tokens,
# the middleware caches previously-seen tokens for a configurable duration
# (in seconds). Set to -1 to disable caching completely. Integer value
# Defaults to $::os_service_default.
#
class heat::keystone::authtoken(
$password = $::os_service_default,
$username = 'heat',
$auth_url = 'http://127.0.0.1:35357/',
$project_name = 'services',
$user_domain_name = 'Default',
$project_domain_name = 'Default',
$insecure = $::os_service_default,
$auth_section = $::os_service_default,
$auth_type = 'password',
$auth_uri = 'http://127.0.0.1:5000/',
$auth_version = $::os_service_default,
$cache = $::os_service_default,
$cafile = $::os_service_default,
$certfile = $::os_service_default,
$check_revocations_for_cached = $::os_service_default,
$delay_auth_decision = $::os_service_default,
$enforce_token_bind = $::os_service_default,
$hash_algorithms = $::os_service_default,
$http_connect_timeout = $::os_service_default,
$http_request_max_retries = $::os_service_default,
$include_service_catalog = $::os_service_default,
$keyfile = $::os_service_default,
$memcache_pool_conn_get_timeout = $::os_service_default,
$memcache_pool_dead_retry = $::os_service_default,
$memcache_pool_maxsize = $::os_service_default,
$memcache_pool_socket_timeout = $::os_service_default,
$memcache_pool_unused_timeout = $::os_service_default,
$memcache_secret_key = $::os_service_default,
$memcache_security_strategy = $::os_service_default,
$memcache_use_advanced_pool = $::os_service_default,
$memcached_servers = $::os_service_default,
$region_name = $::os_service_default,
$revocation_cache_time = $::os_service_default,
$signing_dir = $::os_service_default,
$token_cache_time = $::os_service_default,
) {
if is_service_default($password) and ! $::heat::keystone_password {
fail('Please set password for heat service user')
}
$auth_uri_real = pick($::heat::auth_uri, $auth_uri)
$auth_url_real = pick($::heat::identity_uri, $auth_url)
$auth_type_real = pick($::heat::auth_plugin, $auth_type)
$username_real = pick($::heat::keystone_user, $username)
$password_real = pick($::heat::keystone_password, $password)
$project_name_real = pick($::heat::keystone_tenant, $project_name)
$user_domain_name_real = pick($::heat::keystone_user_domain_name, $user_domain_name)
$project_domain_name_real = pick($::heat::keystone_project_domain_name, $project_domain_name)
$memcached_servers_real = pick($::heat::memcached_servers, $memcached_servers)
keystone::resource::authtoken { 'heat_config':
username => $username_real,
password => $password_real,
project_name => $project_name_real,
auth_url => $auth_url_real,
auth_uri => $auth_uri_real,
auth_version => $auth_version,
auth_type => $auth_type_real,
auth_section => $auth_section,
user_domain_name => $user_domain_name_real,
project_domain_name => $project_domain_name_real,
insecure => $insecure,
cache => $cache,
cafile => $cafile,
certfile => $certfile,
check_revocations_for_cached => $check_revocations_for_cached,
delay_auth_decision => $delay_auth_decision,
enforce_token_bind => $enforce_token_bind,
hash_algorithms => $hash_algorithms,
http_connect_timeout => $http_connect_timeout,
http_request_max_retries => $http_request_max_retries,
include_service_catalog => $include_service_catalog,
keyfile => $keyfile,
memcache_pool_conn_get_timeout => $memcache_pool_conn_get_timeout,
memcache_pool_dead_retry => $memcache_pool_dead_retry,
memcache_pool_maxsize => $memcache_pool_maxsize,
memcache_pool_socket_timeout => $memcache_pool_socket_timeout,
memcache_secret_key => $memcache_secret_key,
memcache_security_strategy => $memcache_security_strategy,
memcache_use_advanced_pool => $memcache_use_advanced_pool,
memcache_pool_unused_timeout => $memcache_pool_unused_timeout,
memcached_servers => $memcached_servers_real,
region_name => $region_name,
revocation_cache_time => $revocation_cache_time,
signing_dir => $signing_dir,
token_cache_time => $token_cache_time,
}
}

View File

@ -0,0 +1,25 @@
---
features:
- Configure keystonemiddleware in a consistent way with all options required
for Keystone v3.
deprecations:
- heat::auth_uri is deprecated in favor of
heat::keystone::authtoken::auth_uri.
- heat::identity_uri is deprecated in favor of
heat::keystone::authtoken::auth_url.
- heat::auth_plugin is deprecated in favor of
heat::keystone::authtoken::auth_type.
- heat::keystone_user is deprecated in favor of
heat::keystone::authtoken::username.
- heat::keystone_tenant is deprecated in favor of
heat::keystone::authtoken::project_name.
- heat::keystone_password is deprecated in favor of
heat::keystone::authtoken::password.
- heat::keystone_user_domain_name is deprecated in favor of
heat::keystone::authtoken::user_domain_name.
- heat::keystone_user_domain_id is deprecated, use the name option.
- heat::keystone_project_domain_name is deprecated in favor of
heat::keystone::authtoken::project_domain_name.
- heat::keystone_project_domain_id is deprecated, use the name option.
- heat::memcached_servers is deprecated in favor of
heat::keystone::authtoken::memcached_servers.

View File

@ -27,14 +27,15 @@ describe 'basic heat' do
require => Class['rabbitmq'],
}
class { '::heat::keystone::authtoken':
password => 'a_big_secret',
}
# heat resources
class { '::heat':
rabbit_userid => 'heat',
rabbit_password => 'an_even_bigger_secret',
rabbit_host => '127.0.0.1',
database_connection => 'mysql+pymysql://heat:a_big_secret@127.0.0.1/heat?charset=utf8',
identity_uri => 'http://127.0.0.1:35357/',
keystone_password => 'a_big_secret',
debug => true,
}
class { '::heat::db::mysql':

View File

@ -11,6 +11,11 @@ describe 'heat::api_cfn' do
end
shared_examples_for 'heat-api-cfn' do
let :pre_condition do
"class {'heat::keystone::authtoken':
password => 'a_big_secret',
}"
end
context 'config params' do
@ -92,7 +97,10 @@ describe 'heat::api_cfn' do
context 'with $sync_db set to false in ::heat' do
let :pre_condition do
"class {'heat': sync_db => false}"
"class {'heat':
keystone_password => 'password',
sync_db => false
}"
end
it 'configures heat-api-cfn service to not subscribe to the dbsync resource' do

View File

@ -10,7 +10,13 @@ describe 'heat::api_cloudwatch' do
:workers => '0' }
end
shared_examples_for 'heat-api-cloudwatch' do
let :pre_condition do
"class { 'heat::keystone::authtoken':
password => 'a_big_secret',
}"
end
context 'config params' do
@ -92,7 +98,10 @@ describe 'heat::api_cloudwatch' do
context 'with $sync_db set to false in ::heat' do
let :pre_condition do
"class {'heat': sync_db => false}"
"class {'heat':
keystone_password => 'password',
sync_db => false
}"
end
it 'configures heat-api-cloudwatch service to not subscribe to the dbsync resource' do

View File

@ -11,6 +11,11 @@ describe 'heat::api' do
end
shared_examples_for 'heat-api' do
let :pre_condition do
"class { 'heat::keystone::authtoken':
password => 'a_big_secret',
}"
end
context 'config params' do
@ -92,7 +97,10 @@ describe 'heat::api' do
context 'with $sync_db set to false in ::heat' do
let :pre_condition do
"class {'heat': sync_db => false}"
"class {'heat':
keystone_password => 'password',
sync_db => false
}"
end
it 'configures heat-api service to not subscribe to the dbsync resource' do

View File

@ -21,7 +21,10 @@ describe 'heat::cron::purge_deleted' do
end
let :pre_condition do
'include ::heat'
"class { 'heat::keystone::authtoken':
password => 'password',
}
include ::heat"
end
describe 'with default parameters' do

View File

@ -1,16 +1,17 @@
require 'spec_helper'
describe 'heat::db::postgresql' do
shared_examples_for 'heat::db::postgresql' do
let :req_params do
{ :password => 'pw' }
end
let :pre_condition do
'include ::postgresql::server
include ::heat
'
"include ::postgresql::server
class { '::heat::keystone::authtoken':
password => 'password',
}
include ::heat"
end
context 'with only required parameters' do

View File

@ -21,6 +21,12 @@ describe 'heat::engine' do
end
shared_examples_for 'heat-engine' do
let :pre_condition do
"class { 'heat::keystone::authtoken':
password => 'password',
}"
end
[
{},
{ :auth_encryption_key => '1234567890AZERTYUIOPMLKJHGFDSQ12' },

View File

@ -58,7 +58,6 @@ describe 'heat' do
it_configures 'with SSL enabled without kombu'
it_configures 'with SSL disabled'
it_configures 'with SSL wrongly configured'
it_configures "with auth_plugin"
it_configures 'with enable_stack_adopt and enable_stack_abandon set'
it_configures 'with notification_driver set to a string'
@ -125,7 +124,7 @@ describe 'heat' do
end
it 'configures auth_uri for clients_keystone' do
is_expected.to contain_heat_config('clients_keystone/auth_uri').with_value( 'http://127.0.0.1:35357/' )
is_expected.to contain_heat_config('clients_keystone/auth_uri').with_value( 'http://127.0.0.1:5000/' )
end
it 'configures keystone_ec2_uri' do
@ -147,10 +146,6 @@ describe 'heat' do
is_expected.to contain_heat_config('clients_heat/url').with_value('<SERVICE DEFAULT>')
end
it 'configures keystone_authtoken memcached' do
is_expected.to contain_heat_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
end
it_configures "with default auth method"
end
@ -368,29 +363,10 @@ describe 'heat' do
shared_examples_for "with default auth method" do
it 'configures auth_uri, identity_uri, admin_tenant_name, admin_user, admin_password' do
is_expected.to contain_heat_config('keystone_authtoken/auth_uri').with_value("http://127.0.0.1:5000/")
is_expected.to contain_heat_config('keystone_authtoken/identity_uri').with_value("http://127.0.0.1:35357/")
is_expected.to contain_heat_config('keystone_authtoken/admin_tenant_name').with_value("services")
is_expected.to contain_heat_config('keystone_authtoken/admin_user').with_value("heat")
is_expected.to contain_heat_config('keystone_authtoken/admin_password').with_secret( true )
end
end
shared_examples_for "with auth_plugin" do
before do
params.merge!({
:auth_plugin => 'password',
})
end
it 'configures ' do
is_expected.to contain_heat_config('keystone_authtoken/auth_plugin').with_value("password")
is_expected.to contain_heat_config('keystone_authtoken/auth_url').with_value("http://127.0.0.1:35357/")
is_expected.to contain_heat_config('keystone_authtoken/project_name').with_value("services")
is_expected.to contain_heat_config('keystone_authtoken/username').with_value("heat")
is_expected.to contain_heat_config('keystone_authtoken/password').with_secret( true )
is_expected.to contain_heat_config('keystone_authtoken/project_name').with_value("services")
is_expected.to contain_heat_config('keystone_authtoken/user_domain_name').with_value('Default')
is_expected.to contain_heat_config('keystone_authtoken/project_domain_name').with_value('Default')
is_expected.to contain_heat_config('keystone_authtoken/user_domain_id').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/project_domain_id').with_value('<SERVICE DEFAULT>')
end
end

View File

@ -0,0 +1,145 @@
require 'spec_helper'
describe 'heat::keystone::authtoken' do
let :params do
{ :password => 'heat_password', }
end
shared_examples 'heat authtoken' do
context 'with default parameters' do
it 'configure keystone_authtoken' do
is_expected.to contain_heat_config('keystone_authtoken/username').with_value('heat')
is_expected.to contain_heat_config('keystone_authtoken/password').with_value('heat_password')
is_expected.to contain_heat_config('keystone_authtoken/auth_url').with_value('http://127.0.0.1:35357/')
is_expected.to contain_heat_config('keystone_authtoken/project_name').with_value('services')
is_expected.to contain_heat_config('keystone_authtoken/user_domain_name').with_value('Default')
is_expected.to contain_heat_config('keystone_authtoken/project_domain_name').with_value('Default')
is_expected.to contain_heat_config('keystone_authtoken/insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/auth_section').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/auth_type').with_value('password')
is_expected.to contain_heat_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/')
is_expected.to contain_heat_config('keystone_authtoken/auth_version').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/cache').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/cafile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/check_revocations_for_cached').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/delay_auth_decision').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/enforce_token_bind').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/hash_algorithms').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/http_connect_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/http_request_max_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/include_service_catalog').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_dead_retry').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_maxsize').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_socket_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_unused_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_secret_key').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_security_strategy').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcache_use_advanced_pool').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/revocation_cache_time').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/signing_dir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_heat_config('keystone_authtoken/token_cache_time').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding parameters' do
before do
params.merge!({
:auth_uri => 'https://10.0.0.1:9999/',
:username => 'myuser',
:password => 'mypasswd',
:auth_url => 'http://:127.0.0.1:35357',
:project_name => 'service_project',
:user_domain_name => 'domainX',
:project_domain_name => 'domainX',
:insecure => false,
:auth_section => 'new_section',
:auth_type => 'password',
:auth_version => 'v3',
:cache => 'somevalue',
:cafile => '/opt/stack/data/cafile.pem',
:certfile => 'certfile.crt',
:check_revocations_for_cached => false,
:delay_auth_decision => false,
:enforce_token_bind => 'permissive',
:hash_algorithms => 'md5',
:http_connect_timeout => '300',
:http_request_max_retries => '3',
:include_service_catalog => true,
:keyfile => 'keyfile',
:memcache_pool_conn_get_timeout => '9',
:memcache_pool_dead_retry => '302',
:memcache_pool_maxsize => '11',
:memcache_pool_socket_timeout => '2',
:memcache_pool_unused_timeout => '61',
:memcache_secret_key => 'secret_key',
:memcache_security_strategy => 'ENCRYPT',
:memcache_use_advanced_pool => true,
:memcached_servers => ['memcached01:11211','memcached02:11211'],
:region_name => 'region2',
:revocation_cache_time => '11',
:signing_dir => '/var/cache',
:token_cache_time => '301',
})
end
it 'configure keystone_authtoken' do
is_expected.to contain_heat_config('keystone_authtoken/auth_uri').with_value('https://10.0.0.1:9999/')
is_expected.to contain_heat_config('keystone_authtoken/username').with_value(params[:username])
is_expected.to contain_heat_config('keystone_authtoken/password').with_value(params[:password]).with_secret(true)
is_expected.to contain_heat_config('keystone_authtoken/auth_url').with_value(params[:auth_url])
is_expected.to contain_heat_config('keystone_authtoken/project_name').with_value(params[:project_name])
is_expected.to contain_heat_config('keystone_authtoken/user_domain_name').with_value(params[:user_domain_name])
is_expected.to contain_heat_config('keystone_authtoken/project_domain_name').with_value(params[:project_domain_name])
is_expected.to contain_heat_config('keystone_authtoken/insecure').with_value(params[:insecure])
is_expected.to contain_heat_config('keystone_authtoken/auth_section').with_value(params[:auth_section])
is_expected.to contain_heat_config('keystone_authtoken/auth_type').with_value(params[:auth_type])
is_expected.to contain_heat_config('keystone_authtoken/auth_version').with_value(params[:auth_version])
is_expected.to contain_heat_config('keystone_authtoken/cache').with_value(params[:cache])
is_expected.to contain_heat_config('keystone_authtoken/cafile').with_value(params[:cafile])
is_expected.to contain_heat_config('keystone_authtoken/certfile').with_value(params[:certfile])
is_expected.to contain_heat_config('keystone_authtoken/check_revocations_for_cached').with_value(params[:check_revocations_for_cached])
is_expected.to contain_heat_config('keystone_authtoken/delay_auth_decision').with_value(params[:delay_auth_decision])
is_expected.to contain_heat_config('keystone_authtoken/enforce_token_bind').with_value(params[:enforce_token_bind])
is_expected.to contain_heat_config('keystone_authtoken/hash_algorithms').with_value(params[:hash_algorithms])
is_expected.to contain_heat_config('keystone_authtoken/http_connect_timeout').with_value(params[:http_connect_timeout])
is_expected.to contain_heat_config('keystone_authtoken/http_request_max_retries').with_value(params[:http_request_max_retries])
is_expected.to contain_heat_config('keystone_authtoken/include_service_catalog').with_value(params[:include_service_catalog])
is_expected.to contain_heat_config('keystone_authtoken/keyfile').with_value(params[:keyfile])
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_conn_get_timeout').with_value(params[:memcache_pool_conn_get_timeout])
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_dead_retry').with_value(params[:memcache_pool_dead_retry])
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_maxsize').with_value(params[:memcache_pool_maxsize])
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_socket_timeout').with_value(params[:memcache_pool_socket_timeout])
is_expected.to contain_heat_config('keystone_authtoken/memcache_pool_unused_timeout').with_value(params[:memcache_pool_unused_timeout])
is_expected.to contain_heat_config('keystone_authtoken/memcache_secret_key').with_value(params[:memcache_secret_key])
is_expected.to contain_heat_config('keystone_authtoken/memcache_security_strategy').with_value(params[:memcache_security_strategy])
is_expected.to contain_heat_config('keystone_authtoken/memcache_use_advanced_pool').with_value(params[:memcache_use_advanced_pool])
is_expected.to contain_heat_config('keystone_authtoken/memcached_servers').with_value('memcached01:11211,memcached02:11211')
is_expected.to contain_heat_config('keystone_authtoken/region_name').with_value(params[:region_name])
is_expected.to contain_heat_config('keystone_authtoken/revocation_cache_time').with_value(params[:revocation_cache_time])
is_expected.to contain_heat_config('keystone_authtoken/signing_dir').with_value(params[:signing_dir])
is_expected.to contain_heat_config('keystone_authtoken/token_cache_time').with_value(params[:token_cache_time])
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'heat authtoken'
end
end
end