diff --git a/lib/puppet/type/trove_conductor_config.rb b/lib/puppet/type/trove_conductor_config.rb index a6395aa5..c196ca68 100644 --- a/lib/puppet/type/trove_conductor_config.rb +++ b/lib/puppet/type/trove_conductor_config.rb @@ -3,7 +3,7 @@ Puppet::Type.newtype(:trove_conductor_config) do ensurable newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from /etc/trove/trove-conductor.conf' + desc 'Section/setting name to manage from /etc/trove/trove-conductor.conf (DEPRECATED)' newvalues(/\S+\/\S+/) end diff --git a/lib/puppet/type/trove_taskmanager_config.rb b/lib/puppet/type/trove_taskmanager_config.rb index e5ccec48..38d9157e 100644 --- a/lib/puppet/type/trove_taskmanager_config.rb +++ b/lib/puppet/type/trove_taskmanager_config.rb @@ -3,7 +3,7 @@ Puppet::Type.newtype(:trove_taskmanager_config) do ensurable newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from /etc/trove/trove-taskmanager.conf' + desc 'Section/setting name to manage from /etc/trove/trove-taskmanager.conf (DEPRECATED)' newvalues(/\S+\/\S+/) end diff --git a/manifests/api.pp b/manifests/api.pp index 12d187f4..8ae8dab4 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -113,7 +113,7 @@ class trove::api( $package_ensure = 'present', $auth_strategy = 'keystone', $taskmanager_queue = 'taskmanager', -) inherits trove { +) { include trove::deps include trove::db @@ -129,27 +129,6 @@ class trove::api( 'DEFAULT/trove_api_workers': value => $workers; } - if $::trove::single_tenant_mode { - trove_config { - 'DEFAULT/remote_nova_client': value => 'trove.common.single_tenant_remote.nova_client_trove_admin'; - 'DEFAULT/remote_cinder_client': value => 'trove.common.single_tenant_remote.cinder_client_trove_admin'; - 'DEFAULT/remote_neutron_client': value => 'trove.common.single_tenant_remote.neutron_client_trove_admin'; - } - } - else { - trove_config { - 'DEFAULT/remote_nova_client': ensure => absent; - 'DEFAULT/remote_cinder_client': ensure => absent; - 'DEFAULT/remote_neutron_client': ensure => absent; - } - } - - oslo::messaging::default { 'trove_config': - transport_url => $::trove::default_transport_url, - control_exchange => $::trove::control_exchange, - rpc_response_timeout => $::trove::rpc_response_timeout, - } - if $auth_strategy == 'keystone' { include trove::keystone::authtoken } @@ -157,7 +136,7 @@ class trove::api( # SSL Options if $cert_file { trove_config { - 'ssl/cert_file' : value => $cert_file; + 'ssl/cert_file': value => $cert_file; } } else { trove_config { @@ -166,7 +145,7 @@ class trove::api( } if $key_file { trove_config { - 'ssl/key_file' : value => $key_file; + 'ssl/key_file': value => $key_file; } } else { trove_config { @@ -175,7 +154,7 @@ class trove::api( } if $ca_file { trove_config { - 'ssl/ca_file' : value => $ca_file; + 'ssl/ca_file': value => $ca_file; } } else { trove_config { @@ -196,79 +175,10 @@ class trove::api( purge => $purge_config, } - # services type - trove_config { - 'DEFAULT/nova_compute_service_type': value => $::trove::nova_compute_service_type; - 'DEFAULT/cinder_service_type': value => $::trove::cinder_service_type; - 'DEFAULT/neutron_service_type': value => $::trove::neutron_service_type; - 'DEFAULT/glance_service_type': value => $::trove::glance_service_type; - 'DEFAULT/swift_service_type': value => $::trove::swift_service_type; - } - - # endpoint type - trove_config { - 'DEFAULT/nova_compute_endpoint_type': value => $::trove::nova_compute_endpoint_type; - 'DEFAULT/cinder_endpoint_type': value => $::trove::cinder_endpoint_type; - 'DEFAULT/neutron_endpoint_type': value => $::trove::neutron_endpoint_type; - 'DEFAULT/swift_endpoint_type': value => $::trove::swift_endpoint_type; - 'DEFAULT/glance_endpoint_type': value => $::trove::glance_endpoint_type; - 'DEFAULT/trove_endpoint_type': value => $::trove::trove_endpoint_type; - } - - if $::trove::use_neutron { - trove_config { - 'DEFAULT/network_label_regex': value => '.*'; - 'DEFAULT/network_driver': value => 'trove.network.neutron.NeutronDriver'; - 'DEFAULT/default_neutron_networks': value => $::trove::default_neutron_networks; - } - } else { - trove_config { - 'DEFAULT/network_label_regex': value => '^private$'; - 'DEFAULT/network_driver': value => 'trove.network.nova.NovaNetwork'; - 'DEFAULT/default_neutron_networks': ensure => absent; - } - } - trove_config { 'DEFAULT/taskmanager_queue': value => $taskmanager_queue; } - oslo::messaging::notifications { 'trove_config': - transport_url => $::trove::notification_transport_url, - driver => $::trove::notification_driver, - topics => $::trove::notification_topics - } - - oslo::messaging::rabbit {'trove_config': - rabbit_ha_queues => $::trove::rabbit_ha_queues, - rabbit_use_ssl => $::trove::rabbit_use_ssl, - kombu_reconnect_delay => $::trove::kombu_reconnect_delay, - kombu_failover_strategy => $::trove::kombu_failover_strategy, - amqp_durable_queues => $::trove::amqp_durable_queues, - kombu_ssl_ca_certs => $::trove::kombu_ssl_ca_certs, - kombu_ssl_certfile => $::trove::kombu_ssl_certfile, - kombu_ssl_keyfile => $::trove::kombu_ssl_keyfile, - kombu_ssl_version => $::trove::kombu_ssl_version - } - - oslo::messaging::amqp { 'trove_config': - server_request_prefix => $::trove::amqp_server_request_prefix, - broadcast_prefix => $::trove::amqp_broadcast_prefix, - group_request_prefix => $::trove::amqp_group_request_prefix, - container_name => $::trove::amqp_container_name, - idle_timeout => $::trove::amqp_idle_timeout, - trace => $::trove::amqp_trace, - ssl_ca_file => $::trove::amqp_ssl_ca_file, - ssl_cert_file => $::trove::amqp_ssl_cert_file, - ssl_key_file => $::trove::amqp_ssl_key_file, - ssl_key_password => $::trove::amqp_ssl_key_password, - sasl_mechanisms => $::trove::amqp_sasl_mechanisms, - sasl_config_dir => $::trove::amqp_sasl_config_dir, - sasl_config_name => $::trove::amqp_sasl_config_name, - username => $::trove::amqp_username, - password => $::trove::amqp_password, - } - trove::generic_service { 'api': enabled => $enabled, manage_service => $manage_service, diff --git a/manifests/conductor.pp b/manifests/conductor.pp index 0170b31e..4497b6c6 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -16,28 +16,6 @@ # (optional) The state of the trove conductor package # Defaults to 'present' # -# [*debug*] -# (optional) Rather to log the trove api service at debug level. -# Default: false -# -# [*log_file*] -# (optional) The path of file used for logging -# If set to $::os_service_default, it will not log to any file. -# Default: /var/log/trove/trove-conductor.log -# -# [*log_dir*] -# (optional) directory to which trove logs are sent. -# If set to $::os_service_default, it will not log to any directory. -# Defaults to '/var/log/trove' -# -# [*use_syslog*] -# (optional) Use syslog for logging. -# Defaults to $::os_service_default -# -# [*log_facility*] -# (optional) Syslog facility to receive log lines. -# Defaults to 'LOG_USER'. -# # [*conductor_manager*] # (optional) Trove conductor manager. # Defaults to 'trove.conductor.manager.Manager'. @@ -60,120 +38,67 @@ # (optional) Authentication URL. # Defaults to undef # +# [*debug*] +# (optional) Rather to log the trove api service at debug level. +# Default: undef +# +# [*log_file*] +# (optional) The path of file used for logging +# If set to $::os_service_default, it will not log to any file. +# Default: undef +# +# [*log_dir*] +# (optional) directory to which trove logs are sent. +# If set to $::os_service_default, it will not log to any directory. +# Defaults undef +# +# [*use_syslog*] +# (optional) Use syslog for logging. +# Defaults to undef +# +# [*log_facility*] +# (optional) Syslog facility to receive log lines. +# Defaults to undef +# class trove::conductor( $enabled = true, $manage_service = true, $package_ensure = 'present', - $debug = $::os_service_default, - $log_file = '/var/log/trove/trove-conductor.log', - $log_dir = '/var/log/trove', - $use_syslog = $::os_service_default, - $log_facility = $::os_service_default, $conductor_manager = 'trove.conductor.manager.Manager', $workers = $::os_workers, $enable_profiler = $::os_service_default, $trace_sqlalchemy = $::os_service_default, # DEPRECATED PARAMETERS - $auth_url = undef -) inherits trove { + $auth_url = undef, + $debug = undef, + $log_file = undef, + $log_dir = undef, + $use_syslog = undef, + $log_facility = undef, +) { include trove::deps include trove::params - include trove::conductor::service_credentials - if $::trove::database_connection { - if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { - require mysql::bindings - require mysql::bindings::python - } elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) { - - } elsif($::trove::database_connection =~ /sqlite:\/\//) { - - } else { - fail("Invalid db connection ${::trove::database_connection}") - } - trove_conductor_config { - 'database/connection': value => $::trove::database_connection; - 'database/idle_timeout': value => $::trove::database_idle_timeout; - } + # Remove individual config files so that we do not leave any parameters + # configured by older version + file { '/etc/trove/trove-conductor.conf': + ensure => absent, + require => Anchor['trove::config::begin'], + notify => Anchor['trove::config::end'] } # basic service config - trove_conductor_config { + trove_config { 'DEFAULT/trove_conductor_workers': value => $workers; } # profiler config - trove_conductor_config { + trove_config { 'profiler/enabled': value => $enable_profiler; 'profiler/trace_sqlalchemy': value => $trace_sqlalchemy; } - if $::trove::single_tenant_mode { - trove_conductor_config { - 'DEFAULT/remote_nova_client': value => 'trove.common.single_tenant_remote.nova_client_trove_admin'; - 'DEFAULT/remote_cinder_client': value => 'trove.common.single_tenant_remote.cinder_client_trove_admin'; - 'DEFAULT/remote_neutron_client': value => 'trove.common.single_tenant_remote.neutron_client_trove_admin'; - } - } - else { - trove_conductor_config { - 'DEFAULT/remote_nova_client': ensure => absent; - 'DEFAULT/remote_cinder_client': ensure => absent; - 'DEFAULT/remote_neutron_client': ensure => absent; - } - } - - oslo::messaging::default { 'trove_conductor_config': - transport_url => $::trove::default_transport_url, - control_exchange => $::trove::control_exchange, - rpc_response_timeout => $::trove::rpc_response_timeout, - } - - oslo::messaging::notifications { 'trove_conductor_config': - transport_url => $::trove::notification_transport_url, - driver => $::trove::notification_driver, - topics => $::trove::notification_topics - } - - oslo::messaging::rabbit {'trove_conductor_config': - rabbit_ha_queues => $::trove::rabbit_ha_queues, - rabbit_use_ssl => $::trove::rabbit_use_ssl, - kombu_reconnect_delay => $::trove::kombu_reconnect_delay, - kombu_failover_strategy => $::trove::kombu_failover_strategy, - amqp_durable_queues => $::trove::amqp_durable_queues, - kombu_ssl_ca_certs => $::trove::kombu_ssl_ca_certs, - kombu_ssl_certfile => $::trove::kombu_ssl_certfile, - kombu_ssl_keyfile => $::trove::kombu_ssl_keyfile, - kombu_ssl_version => $::trove::kombu_ssl_version - } - - oslo::messaging::amqp { 'trove_conductor_config': - server_request_prefix => $::trove::amqp_server_request_prefix, - broadcast_prefix => $::trove::amqp_broadcast_prefix, - group_request_prefix => $::trove::amqp_group_request_prefix, - container_name => $::trove::amqp_container_name, - idle_timeout => $::trove::amqp_idle_timeout, - trace => $::trove::amqp_trace, - ssl_ca_file => $::trove::amqp_ssl_ca_file, - ssl_cert_file => $::trove::amqp_ssl_cert_file, - ssl_key_file => $::trove::amqp_ssl_key_file, - ssl_key_password => $::trove::amqp_ssl_key_password, - sasl_mechanisms => $::trove::amqp_sasl_mechanisms, - sasl_config_dir => $::trove::amqp_sasl_config_dir, - sasl_config_name => $::trove::amqp_sasl_config_name, - username => $::trove::amqp_username, - password => $::trove::amqp_password, - } - - oslo::log { 'trove_conductor_config': - debug => $debug, - log_file => $log_file, - log_dir => $log_dir, - use_syslog => $use_syslog, - syslog_log_facility => $log_facility - } - trove::generic_service { 'conductor': enabled => $enabled, manage_service => $manage_service, diff --git a/manifests/conductor/service_credentials.pp b/manifests/conductor/service_credentials.pp index e34311a2..5680985a 100644 --- a/manifests/conductor/service_credentials.pp +++ b/manifests/conductor/service_credentials.pp @@ -1,3 +1,4 @@ +# DEPRECATED !! # The trove::conductor::service_credentials class helps configure auth settings # # == Parameters @@ -40,26 +41,5 @@ class trove::conductor::service_credentials ( include trove::deps - $auth_url_base = pick($::trove::conductor::auth_url, $auth_url) - $auth_url_real = "${regsubst($auth_url_base, '(\/v3$|\/v2.0$|\/$)', '')}/v3" - - $username_real = pick($::trove::nova_proxy_admin_user, $username) - $password_real = pick($::trove::nova_proxy_admin_pass, $password) - $project_name_real = pick($::trove::nova_proxy_tenant_name, $project_name) - $region_name_real = pick($::trove::os_region_name, $region_name) - - if is_service_default(password_real) { - fail('trove::conductor::service_credentials::password should be set') - } - - trove_conductor_config { - 'service_credentials/auth_url': value => $auth_url_real; - 'service_credentials/username': value => $username_real; - 'service_credentials/password': value => $password_real, secret => true; - 'service_credentials/project_name': value => $project_name_real; - 'service_credentials/project_domain_name': value => $project_domain_name; - 'service_credentials/user_domain_name': value => $user_domain_name; - 'service_credentials/region_name': value => $region_name_real; - } - + warning('The trove::conductor::service_credentials class has been deprecated and has no effect.') } diff --git a/manifests/config.pp b/manifests/config.pp index b734034d..9e1dc303 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -26,16 +26,6 @@ # The value is an hash of trove_config resources. # Defaults to {} # -# [*trove_taskmanager_config*] -# (optional) Allow configuration of arbitrary trove taskmanager configurations. -# The value is an hash of trove_taskmanager_config resources. -# Defaults to {} -# -# [*trove_conductor_config*] -# (optional) Allow configuration of arbitrary trove conductor configurations. -# The value is an hash of trove_conductor_config resources. -# Defaults to {} -# # [*trove_guestagent_config*] # (optional) Allow configuration of arbitrary trove guestagent configurations. # The value is an hash of trove_guestagent_config resources. @@ -61,25 +51,42 @@ # NOTE: The configuration MUST NOT be already handled by this module # or Puppet catalog compilation will fail with duplicate resources. # +# DEPRECATED PARAMETERS +# +# [*trove_taskmanager_config*] +# (optional) Allow configuration of arbitrary trove taskmanager configurations. +# The value is an hash of trove_taskmanager_config resources. +# Defaults to undef +# +# [*trove_conductor_config*] +# (optional) Allow configuration of arbitrary trove conductor configurations. +# The value is an hash of trove_conductor_config resources. +# Defaults to undef +# class trove::config ( $trove_config = {}, - $trove_taskmanager_config = {}, - $trove_conductor_config = {}, $trove_guestagent_config = {}, $trove_api_paste_ini = {}, + # DPERECATED PARAMETERS + $trove_taskmanager_config = undef, + $trove_conductor_config = undef, ) { include trove::deps + if $trove_taskmanager_config != undef { + warning('The trove_taskmanager_config parmaeter is deprecated and has no effect.') + } + + if $trove_conductor_config != undef { + warning('The trove_conductor_config parameter is deprecated and has no effect.') + } + validate_legacy(Hash, 'validate_hash', $trove_config) - validate_legacy(Hash, 'validate_hash', $trove_taskmanager_config) - validate_legacy(Hash, 'validate_hash', $trove_conductor_config) validate_legacy(Hash, 'validate_hash', $trove_guestagent_config) validate_legacy(Hash, 'validate_hash', $trove_api_paste_ini) create_resources('trove_config', $trove_config) - create_resources('trove_taskmanager_config', $trove_taskmanager_config) - create_resources('trove_conductor_config', $trove_conductor_config) create_resources('trove_guestagent_config', $trove_guestagent_config) create_resources('trove_api_paste_ini', $trove_api_paste_ini) } diff --git a/manifests/guestagent.pp b/manifests/guestagent.pp index fe298b92..7af2f262 100644 --- a/manifests/guestagent.pp +++ b/manifests/guestagent.pp @@ -106,7 +106,7 @@ class trove::guestagent( #Deprecated $control_exchange = undef, $auth_url = undef, -) inherits trove { +) { include trove::deps include trove::params diff --git a/manifests/init.pp b/manifests/init.pp index aaaaa2da..817647c2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -337,7 +337,7 @@ class trove( $cinder_service_type = 'volumev3', $swift_service_type = 'object-store', $neutron_service_type = 'network', - $glance_service_type = 'image', + $glance_service_type = 'image', $nova_compute_endpoint_type = $::os_service_default, $cinder_endpoint_type = $::os_service_default, $swift_endpoint_type = $::os_service_default, @@ -391,4 +391,94 @@ class trove( name => $::trove::params::common_package_name, tag => ['openstack', 'trove-package'], } + + # services type + trove_config { + 'DEFAULT/nova_compute_service_type': value => $nova_compute_service_type; + 'DEFAULT/cinder_service_type': value => $cinder_service_type; + 'DEFAULT/neutron_service_type': value => $neutron_service_type; + 'DEFAULT/glance_service_type': value => $glance_service_type; + 'DEFAULT/swift_service_type': value => $swift_service_type; + } + + # endpoint type + trove_config { + 'DEFAULT/nova_compute_endpoint_type': value => $nova_compute_endpoint_type; + 'DEFAULT/cinder_endpoint_type': value => $cinder_endpoint_type; + 'DEFAULT/neutron_endpoint_type': value => $neutron_endpoint_type; + 'DEFAULT/swift_endpoint_type': value => $swift_endpoint_type; + 'DEFAULT/glance_endpoint_type': value => $glance_endpoint_type; + 'DEFAULT/trove_endpoint_type': value => $trove_endpoint_type; + } + + if $single_tenant_mode { + trove_config { + 'DEFAULT/remote_nova_client': value => 'trove.common.single_tenant_remote.nova_client_trove_admin'; + 'DEFAULT/remote_cinder_client': value => 'trove.common.single_tenant_remote.cinder_client_trove_admin'; + 'DEFAULT/remote_neutron_client': value => 'trove.common.single_tenant_remote.neutron_client_trove_admin'; + } + } + else { + trove_config { + 'DEFAULT/remote_nova_client': ensure => absent; + 'DEFAULT/remote_cinder_client': ensure => absent; + 'DEFAULT/remote_neutron_client': ensure => absent; + } + } + + if $use_neutron { + trove_config { + 'DEFAULT/network_label_regex': value => '.*'; + 'DEFAULT/network_driver': value => 'trove.network.neutron.NeutronDriver'; + 'DEFAULT/default_neutron_networks': value => $default_neutron_networks; + } + } else { + trove_config { + 'DEFAULT/network_label_regex': value => '^private$'; + 'DEFAULT/network_driver': value => 'trove.network.nova.NovaNetwork'; + 'DEFAULT/default_neutron_networks': ensure => absent; + } + } + + oslo::messaging::default { 'trove_config': + transport_url => $default_transport_url, + control_exchange => $control_exchange, + rpc_response_timeout => $rpc_response_timeout, + } + + oslo::messaging::notifications { 'trove_config': + transport_url => $notification_transport_url, + driver => $notification_driver, + topics => $notification_topics + } + + oslo::messaging::rabbit { 'trove_config': + rabbit_ha_queues => $rabbit_ha_queues, + rabbit_use_ssl => $rabbit_use_ssl, + kombu_reconnect_delay => $kombu_reconnect_delay, + kombu_failover_strategy => $kombu_failover_strategy, + amqp_durable_queues => $amqp_durable_queues, + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + kombu_ssl_certfile => $kombu_ssl_certfile, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_version => $kombu_ssl_version + } + + oslo::messaging::amqp { 'trove_config': + server_request_prefix => $amqp_server_request_prefix, + broadcast_prefix => $amqp_broadcast_prefix, + group_request_prefix => $amqp_group_request_prefix, + container_name => $amqp_container_name, + idle_timeout => $amqp_idle_timeout, + trace => $amqp_trace, + ssl_ca_file => $amqp_ssl_ca_file, + ssl_cert_file => $amqp_ssl_cert_file, + ssl_key_file => $amqp_ssl_key_file, + ssl_key_password => $amqp_ssl_key_password, + sasl_mechanisms => $amqp_sasl_mechanisms, + sasl_config_dir => $amqp_sasl_config_dir, + sasl_config_name => $amqp_sasl_config_name, + username => $amqp_username, + password => $amqp_password, + } } diff --git a/manifests/taskmanager.pp b/manifests/taskmanager.pp index ccd07e74..6a926d6d 100644 --- a/manifests/taskmanager.pp +++ b/manifests/taskmanager.pp @@ -33,33 +33,11 @@ # (optional) The state of the trove taskmanager package # Defaults to 'present' # -# [*debug*] -# (optional) Rather to log the trove api service at debug level. -# Default: false -# -# [*log_file*] -# (optional) The path of file used for logging -# If set to $::os_service_default, it will not log to any file. -# Default: /var/log/trove/trove-taskmanager.log -# -# [*log_dir*] -# (optional) directory to which trove logs are sent. -# If set to $::os_service_default, it will not log to any directory. -# Defaults to '/var/log/trove' -# -# [*use_syslog*] -# (optional) Use syslog for logging. -# Defaults to $::os_service_default -# # [*guest_log_file*] # (optional) The path of file used for logging. # If set to $::os_service_default, it will not log to any file. # Defaults to '/var/log/trove/trove-guestagent.log' # -# [*log_facility*] -# (optional) Syslog facility to receive log lines. -# Defaults to 'LOG_USER'. -# # [*guestagent_config_file*] # (optional) Trove guest agent configuration file. # Defaults to '/etc/trove/trove-guestagent.conf'. @@ -70,14 +48,6 @@ # # DEPRECATED OPTIONS # -# [*default_neutron_networks*] -# (optional) The network that trove will attach by default. -# Defaults to undef. -# -# [*taskmanager_queue*] -# (optional) Message queue name the Taskmanager will listen to. -# Defaults to 'taskmanager'. -# # [*use_guestagent_template*] # (optional) Use template to provision trove guest agent configuration file. # Defaults to true. @@ -86,159 +56,61 @@ # (optional) Authentication URL. # Defaults to undef # +# [*debug*] +# (optional) Rather to log the trove api service at debug level. +# Default: undef +# +# [*log_file*] +# (optional) The path of file used for logging +# If set to $::os_service_default, it will not log to any file. +# Default: undef +# +# [*log_dir*] +# (optional) directory to which trove logs are sent. +# If set to $::os_service_default, it will not log to any directory. +# Defaults to undef +# +# [*use_syslog*] +# (optional) Use syslog for logging. +# Defaults to undef +# +# [*log_facility*] +# (optional) Syslog facility to receive log lines. +# Defaults to undef +# class trove::taskmanager( $enabled = true, $manage_service = true, - $debug = $::os_service_default, - $log_file = '/var/log/trove/trove-taskmanager.log', - $log_dir = '/var/log/trove', - $use_syslog = $::os_service_default, $guest_log_file = '/var/log/trove/trove-guestagent.log', - $log_facility = $::os_service_default, $package_ensure = 'present', $guestagent_config_file = '/etc/trove/trove-guestagent.conf', $taskmanager_manager = 'trove.taskmanager.manager.Manager', #DEPRECATED OPTIONS - $default_neutron_networks = undef, - $taskmanager_queue = undef, $use_guestagent_template = true, $auth_url = undef, + $debug = undef, + $log_file = undef, + $log_dir = undef, + $use_syslog = undef, + $log_facility = undef, ) inherits trove { include trove::deps include trove::params - include trove::taskmanager::service_credentials - if $default_neutron_networks { - warning("trove::taskmanager::default_neutron_networks is deprecated and will be removed in \ -the future release. Please use trove::default_neutron_networks instead.") - } - $default_neutron_networks_real = pick($default_neutron_networks, $::trove::default_neutron_networks) - - if $taskmanager_queue { - fail('Please use trove::api::taskmanager_queue instead to configure taskmanager_queue') - } - - if $::trove::database_connection { - if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { - require mysql::bindings - require mysql::bindings::python - } elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) { - - } elsif($::trove::database_connection =~ /sqlite:\/\//) { - - } else { - fail("Invalid db connection ${::trove::database_connection}") - } - trove_taskmanager_config { - 'database/connection': value => $::trove::database_connection; - 'database/idle_timeout': value => $::trove::database_idle_timeout; - } + # Remove individual config files so that we do not leave any parameters + # configured by older version + file { '/etc/trove/trove-taskmanager.conf': + ensure => absent, + require => Anchor['trove::config::begin'], + notify => Anchor['trove::config::end'] } # basic service config - trove_taskmanager_config { + trove_config { 'DEFAULT/taskmanager_manager': value => $taskmanager_manager; } - # services type - trove_taskmanager_config { - 'DEFAULT/nova_compute_service_type': value => $::trove::nova_compute_service_type; - 'DEFAULT/cinder_service_type': value => $::trove::cinder_service_type; - 'DEFAULT/neutron_service_type': value => $::trove::neutron_service_type; - 'DEFAULT/glance_service_type': value => $::trove::glance_service_type; - 'DEFAULT/swift_service_type': value => $::trove::swift_service_type; - } - - # endpoint type - trove_taskmanager_config { - 'DEFAULT/nova_compute_endpoint_type': value => $::trove::nova_compute_endpoint_type; - 'DEFAULT/cinder_endpoint_type': value => $::trove::cinder_endpoint_type; - 'DEFAULT/neutron_endpoint_type': value => $::trove::neutron_endpoint_type; - 'DEFAULT/swift_endpoint_type': value => $::trove::swift_endpoint_type; - 'DEFAULT/glance_endpoint_type': value => $::trove::glance_endpoint_type; - 'DEFAULT/trove_endpoint_type': value => $::trove::trove_endpoint_type; - } - - if $::trove::single_tenant_mode { - trove_taskmanager_config { - 'DEFAULT/remote_nova_client': value => 'trove.common.single_tenant_remote.nova_client_trove_admin'; - 'DEFAULT/remote_cinder_client': value => 'trove.common.single_tenant_remote.cinder_client_trove_admin'; - 'DEFAULT/remote_neutron_client': value => 'trove.common.single_tenant_remote.neutron_client_trove_admin'; - } - } - else { - trove_taskmanager_config { - 'DEFAULT/remote_nova_client': ensure => absent; - 'DEFAULT/remote_cinder_client': ensure => absent; - 'DEFAULT/remote_neutron_client': ensure => absent; - } - } - - oslo::messaging::default { 'trove_taskmanager_config': - transport_url => $::trove::default_transport_url, - control_exchange => $::trove::control_exchange, - rpc_response_timeout => $::trove::rpc_response_timeout, - } - - oslo::messaging::notifications { 'trove_taskmanager_config': - transport_url => $::trove::notification_transport_url, - driver => $::trove::notification_driver, - topics => $::trove::notification_topics - } - - oslo::messaging::rabbit { 'trove_taskmanager_config': - rabbit_ha_queues => $::trove::rabbit_ha_queues, - rabbit_use_ssl => $::trove::rabbit_use_ssl, - kombu_reconnect_delay => $::trove::kombu_reconnect_delay, - kombu_failover_strategy => $::trove::kombu_failover_strategy, - amqp_durable_queues => $::trove::amqp_durable_queues, - kombu_ssl_ca_certs => $::trove::kombu_ssl_ca_certs, - kombu_ssl_certfile => $::trove::kombu_ssl_certfile, - kombu_ssl_keyfile => $::trove::kombu_ssl_keyfile, - kombu_ssl_version => $::trove::kombu_ssl_version - } - - oslo::messaging::amqp { 'trove_taskmanager_config': - server_request_prefix => $::trove::amqp_server_request_prefix, - broadcast_prefix => $::trove::amqp_broadcast_prefix, - group_request_prefix => $::trove::amqp_group_request_prefix, - container_name => $::trove::amqp_container_name, - idle_timeout => $::trove::amqp_idle_timeout, - trace => $::trove::amqp_trace, - ssl_ca_file => $::trove::amqp_ssl_ca_file, - ssl_cert_file => $::trove::amqp_ssl_cert_file, - ssl_key_file => $::trove::amqp_ssl_key_file, - ssl_key_password => $::trove::amqp_ssl_key_password, - sasl_mechanisms => $::trove::amqp_sasl_mechanisms, - sasl_config_dir => $::trove::amqp_sasl_config_dir, - sasl_config_name => $::trove::amqp_sasl_config_name, - username => $::trove::amqp_username, - password => $::trove::amqp_password, - } - - if $::trove::use_neutron { - trove_taskmanager_config { - 'DEFAULT/network_label_regex': value => '.*'; - 'DEFAULT/network_driver': value => 'trove.network.neutron.NeutronDriver'; - 'DEFAULT/default_neutron_networks': value => $default_neutron_networks_real; - } - } else { - trove_taskmanager_config { - 'DEFAULT/network_label_regex': value => '^private$'; - 'DEFAULT/network_driver': value => 'trove.network.nova.NovaNetwork'; - 'DEFAULT/default_neutron_networks': ensure => absent; - } - } - - oslo::log { 'trove_taskmanager_config': - debug => $debug, - log_file => $log_file, - log_dir => $log_dir, - use_syslog => $use_syslog, - syslog_log_facility => $log_facility - } - trove::generic_service { 'taskmanager': enabled => $enabled, manage_service => $manage_service, @@ -262,14 +134,14 @@ Please configure options directly with the trove::guestagent class using hiera." } } - trove_taskmanager_config { + trove_config { 'DEFAULT/guest_config': value => $guestagent_config_file } } # TO-DO(mmagr): Disabling transformer workarounds bug #1402055. # Remove this hack as soon as bug is fixed. - trove_taskmanager_config { + trove_config { 'DEFAULT/exists_notification_transformer': ensure => absent, } } diff --git a/manifests/taskmanager/service_credentials.pp b/manifests/taskmanager/service_credentials.pp index 6f7ae7b2..5fbc5f32 100644 --- a/manifests/taskmanager/service_credentials.pp +++ b/manifests/taskmanager/service_credentials.pp @@ -1,3 +1,4 @@ +# DEPRECATED !! # The trove::taskmanager::service_credentials class helps configure auth settings # # == Parameters @@ -40,26 +41,5 @@ class trove::taskmanager::service_credentials ( include trove::deps - $auth_url_base = pick($::trove::taskmanager::auth_url, $auth_url) - $auth_url_real = "${regsubst($auth_url_base, '(\/v3$|\/v2.0$|\/$)', '')}/v3" - - $username_real = pick($::trove::nova_proxy_admin_user, $username) - $password_real = pick($::trove::nova_proxy_admin_pass, $password) - $project_name_real = pick($::trove::nova_proxy_tenant_name, $project_name) - $region_name_real = pick($::trove::os_region_name, $region_name) - - if is_service_default($password_real) { - fail('trove::taskmanager::service_credentials::password should be set') - } - - trove_taskmanager_config { - 'service_credentials/auth_url': value => $auth_url_real; - 'service_credentials/username': value => $username_real; - 'service_credentials/password': value => $password_real, secret => true; - 'service_credentials/project_name': value => $project_name_real; - 'service_credentials/project_domain_name': value => $project_domain_name; - 'service_credentials/user_domain_name': value => $user_domain_name; - 'service_credentials/region_name': value => $region_name_real; - } - + warning('The trove::conductor::service_credentials class has been deprecated and has no effect.') } diff --git a/releasenotes/notes/use-single-config-233fda77f7d6c942.yaml b/releasenotes/notes/use-single-config-233fda77f7d6c942.yaml new file mode 100644 index 00000000..56f84065 --- /dev/null +++ b/releasenotes/notes/use-single-config-233fda77f7d6c942.yaml @@ -0,0 +1,35 @@ +--- +upgrade: + - | + Now this modules no longer use ``trove-conductor.conf`` and + ``trove-taskmanager.conf``. The parameters previously added to these files + are now added to the base ``trove.conf``. + +deprecations: + - | + The following parameters have been deprecated and have no effect now. + + - ``trove::config::trove_taskmanager_config`` + - ``trove::config::trove_conductor_config`` + + - | + The following classes have been deprecated and have no effect now. + + - ``trove::conductor::service_credentials`` + - ``trove::taskmanager::service_credentials`` + + - | + The following parameters of the ``trove::conductor`` class and + the ``trove::taskmanager`` class have been deprecated and have no effect. + + - ``debug`` + - ``log_file`` + - ``log_dir`` + - ``use_syslog`` + - ``log_facility`` + + - | + The following resource types have been deprecated. + + - ``trove_conductor`` + - ``trove_taskmanager`` diff --git a/spec/classes/trove_api_spec.rb b/spec/classes/trove_api_spec.rb index 3335e735..b0f58b6a 100644 --- a/spec/classes/trove_api_spec.rb +++ b/spec/classes/trove_api_spec.rb @@ -31,17 +31,6 @@ describe 'trove::api' do let :pre_condition do "class { 'trove': - nova_compute_service_type => 'compute', - cinder_service_type => 'volume', - swift_service_type => 'object-store', - neutron_service_type => 'network', - glance_service_type => 'image', - nova_compute_endpoint_type => '', - cinder_endpoint_type => '', - swift_endpoint_type => '', - trove_endpoint_type => '', - glance_endpoint_type => '', - neutron_endpoint_type => '', } class { 'trove::api::service_credentials': password => 'verysectrete', @@ -78,52 +67,24 @@ describe 'trove::api' do is_expected.to contain_trove_config('DEFAULT/bind_port').with_value('8779') is_expected.to contain_trove_config('DEFAULT/backlog').with_value('4096') is_expected.to contain_trove_config('DEFAULT/trove_api_workers').with_value('8') - is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_value('') - is_expected.to contain_trove_config('DEFAULT/control_exchange').with_value('trove') - is_expected.to contain_trove_config('DEFAULT/nova_compute_service_type').with_value('compute') - is_expected.to contain_trove_config('DEFAULT/cinder_service_type').with_value('volume') - is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store') - is_expected.to contain_trove_config('DEFAULT/neutron_service_type').with_value('network') - is_expected.to contain_trove_config('DEFAULT/glance_service_type').with_value('image') - is_expected.to contain_trove_config('DEFAULT/nova_compute_endpoint_type').with_value('') - is_expected.to contain_trove_config('DEFAULT/cinder_endpoint_type').with_value('') - is_expected.to contain_trove_config('DEFAULT/swift_endpoint_type').with_value('') - is_expected.to contain_trove_config('DEFAULT/trove_endpoint_type').with_value('') - is_expected.to contain_trove_config('DEFAULT/neutron_endpoint_type').with_value('') - is_expected.to contain_trove_config('DEFAULT/glance_endpoint_type').with_value('') is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('200') is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('200') is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('200') is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('200') is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('200') - is_expected.to contain_trove_config('DEFAULT/transport_url').with_value('') is_expected.to contain_trove_config('DEFAULT/taskmanager_queue').with_value('taskmanager') - is_expected.to contain_trove_config('DEFAULT/rpc_response_timeout').with_value('') - is_expected.to contain_trove_config('DEFAULT/control_exchange').with_value('trove') - is_expected.to contain_trove_config('DEFAULT/remote_nova_client').with_ensure('absent') - is_expected.to contain_trove_config('DEFAULT/remote_cinder_client').with_ensure('absent') - is_expected.to contain_trove_config('DEFAULT/remote_neutron_client').with_ensure('absent') - is_expected.to contain_trove_config('oslo_messaging_notifications/transport_url').with_value('') - is_expected.to contain_trove_config('oslo_messaging_notifications/driver').with_value('') - is_expected.to contain_trove_config('oslo_messaging_notifications/topics').with_value('') - is_expected.to contain_trove_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') - is_expected.to contain_trove_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') - is_expected.to contain_trove_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') is_expected.to contain_trove_config('ssl/cert_file').with_ensure('absent') is_expected.to contain_trove_config('ssl/key_file').with_ensure('absent') is_expected.to contain_trove_config('ssl/ca_file').with_ensure('absent') - is_expected.to contain_oslo__messaging__rabbit('trove_config').with( - :rabbit_use_ssl => '', - ) end context 'with SSL enabled on API' do - before :each do - params.merge!( - :cert_file => 'cert', - :key_file => 'key', - :ca_file => 'ca', - ) + before :each do + params.merge!( + :cert_file => 'cert', + :key_file => 'key', + :ca_file => 'ca', + ) end it 'contains ssl parameters' do @@ -134,14 +95,14 @@ describe 'trove::api' do end context 'with overridden rate limit parameters' do - before :each do - params.merge!( - :http_get_rate => '1000', - :http_post_rate => '1000', - :http_put_rate => '1000', - :http_delete_rate => '1000', - :http_mgmt_post_rate => '2000', - ) + before :each do + params.merge!( + :http_get_rate => '1000', + :http_post_rate => '1000', + :http_put_rate => '1000', + :http_delete_rate => '1000', + :http_mgmt_post_rate => '2000', + ) end it 'contains overrided rate limit values' do @@ -152,255 +113,6 @@ describe 'trove::api' do is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('2000') end end - - context 'with single tenant mode enabled' do - let :pre_condition do - "class { 'trove': - single_tenant_mode => 'true' - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - it 'single tenant client values are set' do - is_expected.to contain_trove_config('DEFAULT/remote_nova_client').with_value('trove.common.single_tenant_remote.nova_client_trove_admin') - is_expected.to contain_trove_config('DEFAULT/remote_cinder_client').with_value('trove.common.single_tenant_remote.cinder_client_trove_admin') - is_expected.to contain_trove_config('DEFAULT/remote_neutron_client').with_value('trove.common.single_tenant_remote.neutron_client_trove_admin') - end - end - - context 'when using a single RabbitMQ server' do - let :pre_condition do - "class { 'trove': } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') - is_expected.to contain_trove_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - end - end - - context 'when using a single RabbitMQ server with enable ha options' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => 'true', - amqp_durable_queues => 'true', - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - is_expected.to contain_trove_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') - end - end - - context 'when using multiple RabbitMQ servers' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => 'true', - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - end - end - - context 'when using Neutron' do - let :pre_condition do - "class { 'trove': - use_neutron => true, - default_neutron_networks => 'trove_service', - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it 'configures trove to use the Neutron network driver' do - is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_value('trove_service') - is_expected.to contain_trove_config('DEFAULT/network_driver').with_value('trove.network.neutron.NeutronDriver') - end - - it 'configures trove to use any network label' do - is_expected.to contain_trove_config('DEFAULT/network_label_regex').with_value('.*') - end - end - - context 'when using Nova Network' do - let :pre_condition do - "class { 'trove': - use_neutron => false - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it 'configures trove to use the Nova Network network driver' do - is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_ensure('absent') - is_expected.to contain_trove_config('DEFAULT/network_driver').with_value('trove.network.nova.NovaNetwork') - end - - it 'configures trove to use the "private" network label' do - is_expected.to contain_trove_config('DEFAULT/network_label_regex').with_value('^private$') - end - end - - end - - context 'with SSL enabled with kombu' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => true, - kombu_ssl_ca_certs => '/path/to/ssl/ca/certs', - kombu_ssl_certfile => '/path/to/ssl/cert/file', - kombu_ssl_keyfile => '/path/to/ssl/keyfile', - kombu_ssl_version => 'TLSv1' - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_config').with( - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => '/path/to/ssl/ca/certs', - :kombu_ssl_certfile => '/path/to/ssl/cert/file', - :kombu_ssl_keyfile => '/path/to/ssl/keyfile', - :kombu_ssl_version => 'TLSv1', - ) - end - end - - context 'with SSL enabled without kombu' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => true - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_config').with( - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => '', - :kombu_ssl_certfile => '', - :kombu_ssl_keyfile => '', - :kombu_ssl_version => '', - ) - end - end - - context 'with SSL disabled' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => false - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_config').with( - :rabbit_use_ssl => false, - :kombu_ssl_ca_certs => '', - :kombu_ssl_certfile => '', - :kombu_ssl_keyfile => '', - :kombu_ssl_version => '', - ) - end - end - - context 'with transport_url entries' do - let :pre_condition do - "class { 'trove': - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', - rpc_response_timeout => '120', - control_exchange => 'openstack', - notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' - } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it do - is_expected.to contain_trove_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - is_expected.to contain_trove_config('DEFAULT/rpc_response_timeout').with_value('120') - is_expected.to contain_trove_config('DEFAULT/control_exchange').with_value('openstack') - is_expected.to contain_trove_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - end - end - - context 'with amqp rpc' do - let :pre_condition do - "class { 'trove': } - class { 'trove::api::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - - it do - is_expected.to contain_trove_config('oslo_messaging_amqp/server_request_prefix').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/broadcast_prefix').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/group_request_prefix').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/container_name').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/idle_timeout').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/trace').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/ssl_ca_file').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/ssl_cert_file').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/ssl_key_file').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/ssl_key_password').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/sasl_mechanisms').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/sasl_config_dir').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/sasl_config_name').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/username').with_value('') - is_expected.to contain_trove_config('oslo_messaging_amqp/password').with_value('') - end end end diff --git a/spec/classes/trove_conductor_service_credentials_spec.rb b/spec/classes/trove_conductor_service_credentials_spec.rb deleted file mode 100644 index 089cd069..00000000 --- a/spec/classes/trove_conductor_service_credentials_spec.rb +++ /dev/null @@ -1,73 +0,0 @@ -# -# Copyright (C) 2020 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -require 'spec_helper' - -describe 'trove::conductor::service_credentials' do - - shared_examples 'trove::conductor::service_credentials' do - - context 'with default parameters' do - let :params do - { - :auth_url => 'http://127.0.0.1:5000/v3', - :password => 'verysecrete' - } - end - - it 'configures service credentials with default parameters' do - is_expected.to contain_trove_conductor_config('service_credentials/auth_url').with_value('http://127.0.0.1:5000/v3') - is_expected.to contain_trove_conductor_config('service_credentials/username').with_value('trove') - is_expected.to contain_trove_conductor_config('service_credentials/password').with_value('verysecrete').with_secret(true) - is_expected.to contain_trove_conductor_config('service_credentials/project_name').with_value('services') - is_expected.to contain_trove_conductor_config('service_credentials/region_name').with_value('RegionOne') - is_expected.to contain_trove_conductor_config('service_credentials/user_domain_name').with_value('Default') - is_expected.to contain_trove_conductor_config('service_credentials/project_domain_name').with_value('Default') - end - end - - context 'when overriding defaults' do - let :params do - { - :auth_url => 'http://127.0.0.1:5000/v3', - :password => 'verysecrete', - :username => 'trove2', - :project_name => 'services2', - :region_name => 'RegionTwo', - :user_domain_name => 'MyDomain', - :project_domain_name => 'MyDomain', - } - end - - it 'configures service credentials with default parameters' do - is_expected.to contain_trove_conductor_config('service_credentials/auth_url').with_value('http://127.0.0.1:5000/v3') - is_expected.to contain_trove_conductor_config('service_credentials/username').with_value('trove2') - is_expected.to contain_trove_conductor_config('service_credentials/project_name').with_value('services2') - is_expected.to contain_trove_conductor_config('service_credentials/region_name').with_value('RegionTwo') - is_expected.to contain_trove_conductor_config('service_credentials/user_domain_name').with_value('MyDomain') - is_expected.to contain_trove_conductor_config('service_credentials/project_domain_name').with_value('MyDomain') - end - end - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - it_configures 'trove::conductor::service_credentials' - end - end - -end diff --git a/spec/classes/trove_conductor_spec.rb b/spec/classes/trove_conductor_spec.rb index 686a9e8d..16a852d1 100644 --- a/spec/classes/trove_conductor_spec.rb +++ b/spec/classes/trove_conductor_spec.rb @@ -5,18 +5,9 @@ describe 'trove::conductor' do shared_examples 'trove-conductor' do context 'with default parameters' do - - let :pre_condition do - "class { 'trove': } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - it 'includes required classes' do is_expected.to contain_class('trove::deps') is_expected.to contain_class('trove::params') - is_expected.to contain_class('trove::conductor::service_credentials') end it 'installs trove-conductor package and service' do @@ -34,219 +25,9 @@ describe 'trove::conductor' do end it 'configures trove-conductor with default parameters' do - is_expected.to contain_trove_conductor_config('DEFAULT/transport_url').with_value('') - is_expected.to contain_trove_conductor_config('DEFAULT/rpc_response_timeout').with_value('') - is_expected.to contain_trove_conductor_config('DEFAULT/control_exchange').with_value('trove') - is_expected.to contain_trove_conductor_config('DEFAULT/remote_nova_client').with_ensure('absent') - is_expected.to contain_trove_conductor_config('DEFAULT/remote_cinder_client').with_ensure('absent') - is_expected.to contain_trove_conductor_config('DEFAULT/remote_neutron_client').with_ensure('absent') - is_expected.to contain_trove_conductor_config('oslo_messaging_notifications/transport_url').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - is_expected.to contain_trove_conductor_config('DEFAULT/trove_conductor_workers').with_value('8') - is_expected.to contain_trove_conductor_config('profiler/enabled').with_value('') - is_expected.to contain_trove_conductor_config('profiler/trace_sqlalchemy').with_value('') - is_expected.to contain_oslo__messaging__rabbit('trove_conductor_config').with( - :rabbit_use_ssl => '', - ) - end - - it 'configures trove-conductor with default logging parameters' do - is_expected.to contain_oslo__log('trove_conductor_config').with( - :use_syslog => '', - :syslog_log_facility => '', - :log_dir => '/var/log/trove', - :log_file => '/var/log/trove/trove-conductor.log', - :debug => '', - ) - end - - context 'with single tenant mode enabled' do - let :pre_condition do - "class { 'trove': - single_tenant_mode => 'true'} - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - it 'single tenant client values are set' do - is_expected.to contain_trove_conductor_config('DEFAULT/remote_nova_client').with_value('trove.common.single_tenant_remote.nova_client_trove_admin') - is_expected.to contain_trove_conductor_config('DEFAULT/remote_cinder_client').with_value('trove.common.single_tenant_remote.cinder_client_trove_admin') - is_expected.to contain_trove_conductor_config('DEFAULT/remote_neutron_client').with_value('trove.common.single_tenant_remote.neutron_client_trove_admin') - end - end - - context 'when using a single RabbitMQ server' do - let :pre_condition do - "class { 'trove': } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-conductor with RabbitMQ' do - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - end - end - - context 'when using a single RabbitMQ server with enable ha options' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => 'true', - amqp_durable_queues => 'true', - } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') - end - end - - context 'when using multiple RabbitMQ servers' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => true, - } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-conductor with RabbitMQ' do - is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - end - end - - context 'when using MySQL' do - let :pre_condition do - "class { 'trove': - database_connection => 'mysql://trove:pass@10.0.0.1/trove' - } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-conductor with RabbitMQ' do - is_expected.to contain_trove_conductor_config('database/connection').with_value('mysql://trove:pass@10.0.0.1/trove') - end + is_expected.to contain_trove_config('DEFAULT/trove_conductor_workers').with_value('8') end end - - context 'with SSL enabled with kombu' do - let :pre_condition do - "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - rabbit_use_ssl => true, - kombu_ssl_ca_certs => '/path/to/ssl/ca/certs', - kombu_ssl_certfile => '/path/to/ssl/cert/file', - kombu_ssl_keyfile => '/path/to/ssl/keyfile', - kombu_ssl_version => 'TLSv1'}" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_conductor_config').with( - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => '/path/to/ssl/ca/certs', - :kombu_ssl_certfile => '/path/to/ssl/cert/file', - :kombu_ssl_keyfile => '/path/to/ssl/keyfile', - :kombu_ssl_version => 'TLSv1', - ) - end - end - - context 'with SSL enabled without kombu' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => true - } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_conductor_config').with( - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => '', - :kombu_ssl_certfile => '', - :kombu_ssl_keyfile => '', - :kombu_ssl_version => '', - ) - end - end - - context 'with SSL disabled' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => false - } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_conductor_config').with( - :rabbit_use_ssl => false, - :kombu_ssl_ca_certs => '', - :kombu_ssl_certfile => '', - :kombu_ssl_keyfile => '', - :kombu_ssl_version => '', - ) - end - end - - context 'with transport_url entries' do - let :pre_condition do - "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', - rpc_response_timeout => '120', - control_exchange => 'openstack', - notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' }" - end - - it do - is_expected.to contain_trove_conductor_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - is_expected.to contain_trove_conductor_config('DEFAULT/rpc_response_timeout').with_value('120') - is_expected.to contain_trove_conductor_config('DEFAULT/control_exchange').with_value('openstack') - is_expected.to contain_trove_conductor_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - end - end - - context 'with amqp messaging' do - let :pre_condition do - "class { 'trove' : } - class { 'trove::conductor::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/server_request_prefix').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/broadcast_prefix').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/group_request_prefix').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/container_name').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/idle_timeout').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/trace').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/ssl_ca_file').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/ssl_cert_file').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/ssl_key_file').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/ssl_key_password').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/sasl_mechanisms').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/sasl_config_dir').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/sasl_config_name').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/username').with_value('') - is_expected.to contain_trove_conductor_config('oslo_messaging_amqp/password').with_value('') - end - end - end on_supported_os({ diff --git a/spec/classes/trove_config_spec.rb b/spec/classes/trove_config_spec.rb index 7aa24442..1235eec7 100644 --- a/spec/classes/trove_config_spec.rb +++ b/spec/classes/trove_config_spec.rb @@ -9,16 +9,6 @@ describe 'trove::config' do 'DEFAULT/bar' => { 'value' => 'barValue' }, 'DEFAULT/baz' => { 'ensure' => 'absent' } }, - :trove_taskmanager_config => { - 'DEFAULT/foo2' => { 'value' => 'fooValue' }, - 'DEFAULT/bar2' => { 'value' => 'barValue' }, - 'DEFAULT/baz2' => { 'ensure' => 'absent' } - }, - :trove_conductor_config => { - 'DEFAULT/foo2' => { 'value' => 'fooValue' }, - 'DEFAULT/bar2' => { 'value' => 'barValue' }, - 'DEFAULT/baz2' => { 'ensure' => 'absent' } - }, :trove_guestagent_config => { 'DEFAULT/foo2' => { 'value' => 'fooValue' }, 'DEFAULT/bar2' => { 'value' => 'barValue' }, @@ -40,18 +30,6 @@ describe 'trove::config' do is_expected.to contain_trove_config('DEFAULT/baz').with_ensure('absent') end - it 'configures arbitrary trove taskmanager configurations' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/foo2').with_value('fooValue') - is_expected.to contain_trove_taskmanager_config('DEFAULT/bar2').with_value('barValue') - is_expected.to contain_trove_taskmanager_config('DEFAULT/baz2').with_ensure('absent') - end - - it 'configures arbitrary trove conductor configurations' do - is_expected.to contain_trove_conductor_config('DEFAULT/foo2').with_value('fooValue') - is_expected.to contain_trove_conductor_config('DEFAULT/bar2').with_value('barValue') - is_expected.to contain_trove_conductor_config('DEFAULT/baz2').with_ensure('absent') - end - it 'configures arbitrary trove guestagent configurations' do is_expected.to contain_trove_guestagent_config('DEFAULT/foo2').with_value('fooValue') is_expected.to contain_trove_guestagent_config('DEFAULT/bar2').with_value('barValue') diff --git a/spec/classes/trove_init_spec.rb b/spec/classes/trove_init_spec.rb index 3d595179..7cb955db 100644 --- a/spec/classes/trove_init_spec.rb +++ b/spec/classes/trove_init_spec.rb @@ -40,6 +40,58 @@ describe 'trove' do is_expected.to contain_trove_config('DEFAULT/cinder_url').with_value('http://localhost:8776/v1') is_expected.to contain_trove_config('DEFAULT/swift_url').with_value('http://localhost:8080/v1/AUTH_') is_expected.to contain_trove_config('DEFAULT/neutron_url').with_value('http://localhost:9696/') + is_expected.to contain_trove_config('DEFAULT/nova_compute_service_type').with_value('compute') + is_expected.to contain_trove_config('DEFAULT/cinder_service_type').with_value('volumev3') + is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store') + is_expected.to contain_trove_config('DEFAULT/neutron_service_type').with_value('network') + is_expected.to contain_trove_config('DEFAULT/glance_service_type').with_value('image') + is_expected.to contain_trove_config('DEFAULT/nova_compute_endpoint_type').with_value('') + is_expected.to contain_trove_config('DEFAULT/cinder_endpoint_type').with_value('') + is_expected.to contain_trove_config('DEFAULT/swift_endpoint_type').with_value('') + is_expected.to contain_trove_config('DEFAULT/trove_endpoint_type').with_value('') + is_expected.to contain_trove_config('DEFAULT/neutron_endpoint_type').with_value('') + is_expected.to contain_trove_config('DEFAULT/glance_endpoint_type').with_value('') + is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_value('') + is_expected.to contain_trove_config('DEFAULT/remote_nova_client').with_ensure('absent') + is_expected.to contain_trove_config('DEFAULT/remote_cinder_client').with_ensure('absent') + is_expected.to contain_trove_config('DEFAULT/remote_neutron_client').with_ensure('absent') + is_expected.to contain_oslo__messaging__default('trove_config').with( + :transport_url => '', + :rpc_response_timeout => '', + :control_exchange => 'trove' + ) + is_expected.to contain_oslo__messaging__rabbit('trove_config').with( + :rabbit_ha_queues => '', + :rabbit_use_ssl => '', + :kombu_reconnect_delay => '', + :kombu_failover_strategy => '', + :amqp_durable_queues => '', + :kombu_ssl_ca_certs => '', + :kombu_ssl_certfile => '', + :kombu_ssl_keyfile => '', + :kombu_ssl_version => '', + ) + is_expected.to contain_oslo__messaging__amqp('trove_config').with( + :server_request_prefix => '', + :broadcast_prefix => '', + :group_request_prefix => '', + :container_name => '', + :idle_timeout => '', + :trace => '', + :ssl_ca_file => '', + :ssl_cert_file => '', + :ssl_key_file => '', + :sasl_mechanisms => '', + :sasl_config_dir => '', + :sasl_config_name => '', + :username => '', + :password => '', + ) + is_expected.to contain_oslo__messaging__notifications('trove_config').with( + :transport_url => '', + :driver => '', + :topics => '' + ) } it 'installs common package' do @@ -50,6 +102,50 @@ describe 'trove' do ) end end + + context 'with single tenant mode enabled' do + let :params do + { :single_tenant_mode => true } + end + + it 'single tenant client values are set' do + is_expected.to contain_trove_config('DEFAULT/remote_nova_client').with_value('trove.common.single_tenant_remote.nova_client_trove_admin') + is_expected.to contain_trove_config('DEFAULT/remote_cinder_client').with_value('trove.common.single_tenant_remote.cinder_client_trove_admin') + is_expected.to contain_trove_config('DEFAULT/remote_neutron_client').with_value('trove.common.single_tenant_remote.neutron_client_trove_admin') + end + end + + context 'when using Neutron' do + let :params do + { :use_neutron => true, + :default_neutron_networks => 'trove_service' } + end + + it 'configures trove to use the Neutron network driver' do + is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_value('trove_service') + is_expected.to contain_trove_config('DEFAULT/network_driver').with_value('trove.network.neutron.NeutronDriver') + end + + it 'configures trove to use any network label' do + is_expected.to contain_trove_config('DEFAULT/network_label_regex').with_value('.*') + end + end + + context 'when using Nova Network' do + let :params do + { :use_neutron => false } + end + + it 'configures trove to use the Nova Network network driver' do + is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_ensure('absent') + is_expected.to contain_trove_config('DEFAULT/network_driver').with_value('trove.network.nova.NovaNetwork') + end + + it 'configures trove to use the "private" network label' do + is_expected.to contain_trove_config('DEFAULT/network_label_regex').with_value('^private$') + end + end + end on_supported_os({ diff --git a/spec/classes/trove_taskmanager_service_credentials_spec.rb b/spec/classes/trove_taskmanager_service_credentials_spec.rb deleted file mode 100644 index 7db30048..00000000 --- a/spec/classes/trove_taskmanager_service_credentials_spec.rb +++ /dev/null @@ -1,73 +0,0 @@ -# -# Copyright (C) 2020 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -require 'spec_helper' - -describe 'trove::taskmanager::service_credentials' do - - shared_examples 'trove::taskmanager::service_credentials' do - - context 'with default parameters' do - let :params do - { - :auth_url => 'http://127.0.0.1:5000/v3', - :password => 'verysecrete' - } - end - - it 'configures service credentials with default parameters' do - is_expected.to contain_trove_taskmanager_config('service_credentials/auth_url').with_value('http://127.0.0.1:5000/v3') - is_expected.to contain_trove_taskmanager_config('service_credentials/username').with_value('trove') - is_expected.to contain_trove_taskmanager_config('service_credentials/password').with_value('verysecrete').with_secret(true) - is_expected.to contain_trove_taskmanager_config('service_credentials/project_name').with_value('services') - is_expected.to contain_trove_taskmanager_config('service_credentials/region_name').with_value('RegionOne') - is_expected.to contain_trove_taskmanager_config('service_credentials/user_domain_name').with_value('Default') - is_expected.to contain_trove_taskmanager_config('service_credentials/project_domain_name').with_value('Default') - end - end - - context 'when overriding defaults' do - let :params do - { - :auth_url => 'http://127.0.0.1:5000/v3', - :password => 'verysecrete', - :username => 'trove2', - :project_name => 'services2', - :region_name => 'RegionTwo', - :user_domain_name => 'MyDomain', - :project_domain_name => 'MyDomain', - } - end - - it 'configures service credentials with default parameters' do - is_expected.to contain_trove_taskmanager_config('service_credentials/auth_url').with_value('http://127.0.0.1:5000/v3') - is_expected.to contain_trove_taskmanager_config('service_credentials/username').with_value('trove2') - is_expected.to contain_trove_taskmanager_config('service_credentials/project_name').with_value('services2') - is_expected.to contain_trove_taskmanager_config('service_credentials/region_name').with_value('RegionTwo') - is_expected.to contain_trove_taskmanager_config('service_credentials/user_domain_name').with_value('MyDomain') - is_expected.to contain_trove_taskmanager_config('service_credentials/project_domain_name').with_value('MyDomain') - end - end - end - - on_supported_os({ - :supported_os => OSDefaults.get_supported_os - }).each do |os,facts| - context "on #{os}" do - it_configures 'trove::taskmanager::service_credentials' - end - end - -end diff --git a/spec/classes/trove_taskmanager_spec.rb b/spec/classes/trove_taskmanager_spec.rb index 46c81bb8..48c7e2f9 100644 --- a/spec/classes/trove_taskmanager_spec.rb +++ b/spec/classes/trove_taskmanager_spec.rb @@ -24,31 +24,9 @@ describe 'trove::taskmanager' do shared_examples 'trove-taskmanager' do context 'with default parameters' do - - let :pre_condition do - "class { 'trove': - nova_compute_service_type => 'compute', - cinder_service_type => 'volume', - swift_service_type => 'object-store', - neutron_service_type => 'network', - glance_service_type => 'image', - nova_compute_endpoint_type => '', - cinder_endpoint_type => '', - swift_endpoint_type => '', - trove_endpoint_type => '', - glance_endpoint_type => '', - neutron_endpoint_type => '', - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - region_name => 'RegionOne', - }" - end - it 'includes required classes' do is_expected.to contain_class('trove::deps') is_expected.to contain_class('trove::params') - is_expected.to contain_class('trove::taskmanager::service_credentials') end it 'installs trove-taskmanager package and service' do @@ -66,313 +44,24 @@ describe 'trove::taskmanager' do end it 'configures trove-taskmanager with default parameters' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/default_neutron_networks').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/nova_compute_service_type').with_value('compute') - is_expected.to contain_trove_taskmanager_config('DEFAULT/cinder_service_type').with_value('volume') - is_expected.to contain_trove_taskmanager_config('DEFAULT/swift_service_type').with_value('object-store') - is_expected.to contain_trove_taskmanager_config('DEFAULT/neutron_service_type').with_value('network') - is_expected.to contain_trove_taskmanager_config('DEFAULT/glance_service_type').with_value('image') - is_expected.to contain_trove_taskmanager_config('DEFAULT/nova_compute_endpoint_type').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/cinder_endpoint_type').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/swift_endpoint_type').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/trove_endpoint_type').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/neutron_endpoint_type').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/glance_endpoint_type').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/taskmanager_manager').with_value('trove.taskmanager.manager.Manager') + is_expected.to contain_trove_config('DEFAULT/taskmanager_manager').with_value('trove.taskmanager.manager.Manager') + is_expected.to contain_trove_config('DEFAULT/guest_config').with_value('/etc/trove/trove-guestagent.conf') is_expected.to contain_file('/etc/trove/trove-guestagent.conf') - is_expected.to contain_trove_taskmanager_config('DEFAULT/transport_url').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/rpc_response_timeout').with_value('') - is_expected.to contain_trove_taskmanager_config('DEFAULT/control_exchange').with_value('trove') - is_expected.to contain_trove_taskmanager_config('DEFAULT/remote_nova_client').with_ensure('absent') - is_expected.to contain_trove_taskmanager_config('DEFAULT/remote_cinder_client').with_ensure('absent') - is_expected.to contain_trove_taskmanager_config('DEFAULT/remote_neutron_client').with_ensure('absent') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/transport_url').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/driver').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/topics').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/kombu_failover_strategy').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - is_expected.to contain_oslo__messaging__rabbit('trove_taskmanager_config').with( - :rabbit_use_ssl => '', - ) - end - - it 'configures trove-taskmanager with default logging parameters' do - is_expected.to contain_oslo__log('trove_taskmanager_config').with( - :use_syslog => '', - :syslog_log_facility => '', - :log_dir => '/var/log/trove', - :log_file => '/var/log/trove/trove-taskmanager.log', - :debug => '', - ) - end - - context 'when set use_guestagent_template to false' do - let :pre_condition do - "class { 'trove': } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - } - class { 'trove::taskmanager': - use_guestagent_template => false, - }" - end - it 'configures trove-taskmanager with trove::guestagent' do - is_expected.to contain_class('trove::guestagent').with( - :enabled => false, - :manage_service => false, - ) - end - end - - context 'with single tenant mode enabled' do - let :pre_condition do - "class { 'trove': - single_tenant_mode => 'true' - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - } - class { 'trove::keystone::authtoken': - password => 'a_big_secret', - }" - end - it 'single tenant client values are set' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/remote_nova_client').with_value('trove.common.single_tenant_remote.nova_client_trove_admin') - is_expected.to contain_trove_taskmanager_config('DEFAULT/remote_cinder_client').with_value('trove.common.single_tenant_remote.cinder_client_trove_admin') - is_expected.to contain_trove_taskmanager_config('DEFAULT/remote_neutron_client').with_value('trove.common.single_tenant_remote.neutron_client_trove_admin') - end - end - - context 'when using a single RabbitMQ server' do - let :pre_condition do - "class { 'trove': } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - } - " - end - it 'configures trove-taskmanager with RabbitMQ' do - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') - - # trove taskmanager also configures trove_guestagent.conf by default, ensure rabbit is right there - is_expected.to contain_file('/etc/trove/trove-guestagent.conf').with_content(/^#rabbit_ha_queues=false$/) - end - end - - context 'when using a single RabbitMQ server with enable rabbbit ha options' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => 'true', - amqp_durable_queues => 'true', - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') - - # trove taskmanager also configures trove_guestagent.conf by default, ensure rabbit is right there - is_expected.to contain_file('/etc/trove/trove-guestagent.conf').with_content(/^rabbit_ha_queues=true$/) - is_expected.to contain_file('/etc/trove/trove-guestagent.conf').with_content(/^amqp_durable_queues=true$/) - end - end - - context 'when using multiple RabbitMQ servers' do - let :pre_condition do - "class { 'trove': - rabbit_ha_queues => 'true', - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-taskmanager with RabbitMQ' do - is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') - - # trove taskmanager also configures trove_guestagent.conf by default, ensure rabbit is right there - is_expected.to contain_file('/etc/trove/trove-guestagent.conf').with_content(/^rabbit_ha_queues=true$/) - end - end - - context 'when using MySQL' do - let :pre_condition do - "class { 'trove': - database_connection => 'mysql://trove:pass@10.0.0.1/trove' - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - it 'configures trove-taskmanager with RabbitMQ' do - is_expected.to contain_trove_taskmanager_config('database/connection').with_value('mysql://trove:pass@10.0.0.1/trove') - end - end - - context 'when using Neutron' do - let :pre_condition do - "class { 'trove': - use_neutron => true - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - } - class { 'trove::taskmanager': - default_neutron_networks => 'trove_service', - } - " - - end - - it 'configures trove to use the Neutron network driver' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/default_neutron_networks').with_value('trove_service') - is_expected.to contain_trove_taskmanager_config('DEFAULT/network_driver').with_value('trove.network.neutron.NeutronDriver') - - end - - it 'configures trove to use any network label' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/network_label_regex').with_value('.*') - end - end - - context 'when using Nova Network' do - let :pre_condition do - "class { 'trove': - use_neutron => false - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - - end - - it 'configures trove to use the Nova Network network driver' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/default_neutron_networks').with_ensure('absent') - is_expected.to contain_trove_taskmanager_config('DEFAULT/network_driver').with_value('trove.network.nova.NovaNetwork') - end - - it 'configures trove to use the "private" network label' do - is_expected.to contain_trove_taskmanager_config('DEFAULT/network_label_regex').with_value('^private$') - end - end - end - context 'with SSL enabled with kombu' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => true, - kombu_ssl_ca_certs => '/path/to/ssl/ca/certs', - kombu_ssl_certfile => '/path/to/ssl/cert/file', - kombu_ssl_keyfile => '/path/to/ssl/keyfile', - kombu_ssl_version => 'TLSv1' - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_taskmanager_config').with( - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => '/path/to/ssl/ca/certs', - :kombu_ssl_certfile => '/path/to/ssl/cert/file', - :kombu_ssl_keyfile => '/path/to/ssl/keyfile', - :kombu_ssl_version => 'TLSv1', - ) end end - context 'with SSL enabled without kombu' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => true - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" + context 'when set use_guestagent_template to false' do + let :params do + { :use_guestagent_template => false } end - it do - is_expected.to contain_oslo__messaging__rabbit('trove_taskmanager_config').with( - :rabbit_use_ssl => true, - :kombu_ssl_ca_certs => '', - :kombu_ssl_certfile => '', - :kombu_ssl_keyfile => '', - :kombu_ssl_version => '', + it 'configures trove-taskmanager with trove::guestagent' do + is_expected.to contain_class('trove::guestagent').with( + :enabled => false, + :manage_service => false, ) end end - - context 'with SSL disabled' do - let :pre_condition do - "class { 'trove': - rabbit_use_ssl => false - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_oslo__messaging__rabbit('trove_taskmanager_config').with( - :rabbit_use_ssl => false, - :kombu_ssl_ca_certs => '', - :kombu_ssl_certfile => '', - :kombu_ssl_keyfile => '', - :kombu_ssl_version => '', - ) - end - end - - context 'with transport_url entries' do - let :pre_condition do - "class { 'trove': - default_transport_url => 'rabbit://rabbit_user:password@localhost:5673', - rpc_response_timeout => '120', - control_exchange => 'openstack', - notification_transport_url => 'rabbit://rabbit_user:password@localhost:5673' - } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_trove_taskmanager_config('DEFAULT/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - is_expected.to contain_trove_taskmanager_config('DEFAULT/rpc_response_timeout').with_value('120') - is_expected.to contain_trove_taskmanager_config('DEFAULT/control_exchange').with_value('openstack') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_notifications/transport_url').with_value('rabbit://rabbit_user:password@localhost:5673') - end - end - - context 'with amqp messaging' do - let :pre_condition do - "class { 'trove' : } - class { 'trove::taskmanager::service_credentials': - password => 'verysecrete', - }" - end - - it do - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/server_request_prefix').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/broadcast_prefix').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/group_request_prefix').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/container_name').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/idle_timeout').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/trace').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/ssl_ca_file').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/ssl_cert_file').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/ssl_key_file').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/ssl_key_password').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/sasl_mechanisms').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/sasl_config_dir').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/sasl_config_name').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/username').with_value('') - is_expected.to contain_trove_taskmanager_config('oslo_messaging_amqp/password').with_value('') - end - end end on_supported_os({