]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Configure oslo related parameters using puppet-oslo
authoriberezovskiy <iberezovskiy@mirantis.com>
Tue, 29 Mar 2016 12:58:33 +0000 (15:58 +0300)
committeriberezovskiy <iberezovskiy@mirantis.com>
Mon, 11 Apr 2016 15:11:08 +0000 (18:11 +0300)
Additonal changes:

  * switch oslo related parameters to $::os_service_default
    as they are used in oslo defines
  * update unit tests
  * update docs for oslo parameters

Change-Id: I4f813444fbf141abe7f10b3aef7d1aa314ac0ac4

manifests/db.pp
manifests/init.pp
manifests/logging.pp
manifests/policy.pp
metadata.json
releasenotes/notes/switch_to_oslo_everywhere-7412fe9a4dffdf71.yaml [new file with mode: 0644]
spec/classes/ceilometer_db_spec.rb
spec/classes/ceilometer_init_spec.rb

index 4818ddd9fb65fa12a2bbbad27d76a8c47a1291b1..0f0bc5cf3ea98ba7152cff6488d14ffc18d9c682 100644 (file)
 #   (Optional) If set, use this value for max_overflow with sqlalchemy.
 #   Defaults to $::os_service_default.
 #
-# [*mongodb_replica_set*]
-#   (Optional) DEPRECATED. The name of the replica set which is used to connect to MongoDB
-#   database. If it is set, MongoReplicaSetClient will be used instead
-#   of MongoClient.
-#   Defaults to undef (string value).
-#
 # [*sync_db*]
 #   (Optional) enable dbsync.
 #   Defaults to true.
@@ -54,62 +48,18 @@ class ceilometer::db (
   $database_retry_interval = $::os_service_default,
   $database_max_overflow   = $::os_service_default,
   $sync_db                 = true,
-  # DEPRECATED PARAMETERS
-  $mongodb_replica_set     = undef,
 ) {
 
-  include ::ceilometer::params
-
   Package<| title == 'ceilometer-common' |> -> Class['ceilometer::db']
 
-  if $mongodb_replica_set {
-    warning('mongodb_replica_set parameter is deprecated in Mitaka and has no effect. Add ?replicaSet=myreplicatset in database_connection instead.')
-  }
-
-  validate_re($database_connection,
-    '^(sqlite|mysql(\+pymysql)?|postgresql|mongodb):\/\/(\S+:\S+@\S+\/\S+)?')
-
-  case $database_connection {
-    /^mysql(\+pymysql)?:\/\//: {
-      require 'mysql::bindings'
-      require 'mysql::bindings::python'
-      if $database_connection =~ /^mysql\+pymysql/ {
-        $backend_package = $::ceilometer::params::pymysql_package_name
-      } else {
-        $backend_package = false
-      }
-    }
-    /^postgresql:\/\//: {
-      $backend_package = false
-      require 'postgresql::lib::python'
-    }
-    /^mongodb:\/\//: {
-      $backend_package = $::ceilometer::params::pymongo_package_name
-    }
-    /^sqlite:\/\//: {
-      $backend_package = $::ceilometer::params::sqlite_package_name
-    }
-    default: {
-      fail('Unsupported backend configured')
-    }
-  }
-
-  if $backend_package and !defined(Package[$backend_package]) {
-    package {'ceilometer-backend-package':
-      ensure => present,
-      name   => $backend_package,
-      tag    => 'openstack',
-    }
-  }
-
-  ceilometer_config {
-    'database/connection':     value => $database_connection, secret => true;
-    'database/idle_timeout':   value => $database_idle_timeout;
-    'database/min_pool_size':  value => $database_min_pool_size;
-    'database/max_retries':    value => $database_max_retries;
-    'database/retry_interval': value => $database_retry_interval;
-    'database/max_pool_size':  value => $database_max_pool_size;
-    'database/max_overflow':   value => $database_max_overflow;
+  oslo::db { 'ceilometer_config':
+    connection     => $database_connection,
+    idle_timeout   => $database_idle_timeout,
+    min_pool_size  => $database_min_pool_size,
+    max_retries    => $database_max_retries,
+    retry_interval => $database_retry_interval,
+    max_pool_size  => $database_max_pool_size,
+    max_overflow   => $database_max_overflow,
   }
 
   if $sync_db {
index 2cee6b9a7524aca5d6f7ce2b74e88216e3aba05a..7390bc1cf1ec33af55b9f5ea968a81778e863580 100644 (file)
 #    Defaults to undef.
 #
 #  [*rpc_backend*]
-#    (Optional) what rpc/queuing service to use
-#    Defaults to 'rabbit'.
+#    The messaging driver to use, defaults to rabbit. Other drivers include
+#    amqp and zmq. (string value)
+#    Default to $::os_service_default
 #
 #  [*rabbit_host*]
-#    (Optional) ip or hostname of the rabbit server.
-#    Defaults to '127.0.0.1'.
+#   (Optional) The RabbitMQ broker address where a single node is used.
+#   (string value)
+#   Defaults to $::os_service_default
 #
 #  [*rabbit_port*]
-#    (Optional)  port of the rabbit server.
-#    Defaults to 5672.
+#   (Optional) The RabbitMQ broker port where a single node is used.
+#   (port value)
+#   Defaults to $::os_service_default
 #
 #  [*rabbit_hosts*]
-#    (Optional) array of host:port (used with HA queues).
-#    If defined, will remove rabbit_host & rabbit_port parameters from config
-#    Defaults to undef.
+#   (Optional) RabbitMQ HA cluster host:port pairs. (array value)
+#   Defaults to $::os_service_default
 #
 #  [*rabbit_userid*]
-#    (Optional) user to connect to the rabbit server.
-#    Defaults to 'guest'.
+#   (Optional) The RabbitMQ userid. (string value)
+#   Defaults to $::os_service_default
 #
 #  [*rabbit_password*]
-#    (Optional) password to connect to the rabbit_server.
-#    Defaults to empty.
+#   (Optional) The RabbitMQ password. (string value)
+#   Defaults to $::os_service_default
 #
 #  [*rabbit_virtual_host*]
-#    (Optional) virtualhost to use.
-#    Defaults to '/'.
+#   (Optional) The RabbitMQ virtual host. (string value)
+#   Defaults to $::os_service_default
 #
 # [*rabbit_ha_queues*]
-#   (Optional) Use HA queues in RabbitMQ (x-ha-policy: all).
-#   Defaults to undef.
+#   (Optional) Use HA queues in RabbitMQ (x-ha-policy: all). If you change this
+#   option, you must wipe the RabbitMQ database. (boolean value)
+#   Defaults to $::os_service_default
 #
 # [*rabbit_heartbeat_timeout_threshold*]
-#   (Optional) Number of seconds after which the RabbitMQ broker is considered
-#   down if the heartbeat keepalive fails.  Any value >0 enables heartbeats.
-#   Heartbeating helps to ensure the TCP connection to RabbitMQ isn't silently
-#   closed, resulting in missed or lost messages from the queue.
-#   (Requires kombu >= 3.0.7 and amqp >= 1.4.0)
-#   Defaults to 0.
+#   (Optional) Number of seconds after which the Rabbit broker is
+#   considered down if heartbeat's keep-alive fails
+#   (0 disable the heartbeat). EXPERIMENTAL. (integer value)
+#   Defaults to $::os_service_default
 #
 # [*rabbit_heartbeat_rate*]
-#   (Optional) How often during the rabbit_heartbeat_timeout_threshold period to
-#   check the heartbeat on RabbitMQ connection.  (i.e. rabbit_heartbeat_rate=2
-#   when rabbit_heartbeat_timeout_threshold=60, the heartbeat will be checked
-#   every 30 seconds.
-#   Defaults to 2.
+#   (Optional) How often times during the heartbeat_timeout_threshold
+#   we check the heartbeat. (integer value)
+#   Defaults to $::os_service_default
 #
 #  [*rabbit_use_ssl*]
-#    (Optional) Connect over SSL for RabbitMQ
-#    Defaults to false.
+#   (Optional) Connect over SSL for RabbitMQ. (boolean value)
+#   Defaults to $::os_service_default
 #
 #  [*amqp_durable_queues*]
 #    (optional) Define queues as "durable" to rabbitmq.
 #    Defaults to $::os_service_default
 #
 #  [*kombu_ssl_ca_certs*]
-#    (Optional) SSL certification authority file (valid only if SSL enabled).
-#    Defaults to undef.
+#   (Optional) SSL certification authority file (valid only if SSL enabled).
+#   (string value)
+#   Defaults to $::os_service_default
 #
 #  [*kombu_ssl_certfile*]
-#    (Optional) SSL cert file (valid only if SSL enabled).
-#    Defaults to undef.
+#   (Optional) SSL cert file (valid only if SSL enabled). (string value)
+#   Defaults to $::os_service_default
 #
 #  [*kombu_ssl_keyfile*]
-#    (Optional) SSL key file (valid only if SSL enabled).
-#    Defaults to undef.
+#   (Optional) SSL key file (valid only if SSL enabled). (string value)
+#   Defaults to $::os_service_default
 #
 #  [*kombu_ssl_version*]
-#    (Optional) SSL version to use (valid only if SSL enabled).
-#    Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
-#    available on some distributions.
-#    Defaults to 'TLSv1'.
+#   (Optional) SSL version to use (valid only if SSL enabled). '
+#   Valid values are TLSv1 and SSLv23. SSLv2, SSLv3, TLSv1_1,
+#   and TLSv1_2 may be available on some distributions. (string value)
+#   Defaults to $::os_service_default
+#
+# [*kombu_reconnect_delay*]
+#   (Optional) How long to wait before reconnecting in response
+#   to an AMQP consumer cancel notification. (floating point value)
+#   Defaults to $::os_service_default
+#
+# [*kombu_compression*]
+#   (optional) Possible values are: gzip, bz2. If not set compression will not
+#   be used. This option may notbe available in future versions. EXPERIMENTAL.
+#   (string value)
+#   Defaults to $::os_service_default
 #
 #  [*memcached_servers*]
-#    (Optional) A list of memcached server(s) to use for caching.
-#    Defaults to undef.
+#    (Optional) A list of memcached server(s) to use for caching. (list value)
+#    Defaults to $::os_service_default
 #
 # === DEPRECATED PARAMETERS:
 #
@@ -163,23 +174,25 @@ class ceilometer(
   $use_syslog                         = undef,
   $use_stderr                         = undef,
   $log_facility                       = undef,
-  $rpc_backend                        = 'rabbit',
-  $rabbit_host                        = '127.0.0.1',
-  $rabbit_port                        = 5672,
-  $rabbit_hosts                       = undef,
-  $rabbit_userid                      = 'guest',
-  $rabbit_password                    = '',
-  $rabbit_virtual_host                = '/',
-  $rabbit_ha_queues                   = undef,
-  $rabbit_heartbeat_timeout_threshold = 0,
-  $rabbit_heartbeat_rate              = 2,
+  $rpc_backend                        = $::os_service_default,
+  $rabbit_host                        = $::os_service_default,
+  $rabbit_port                        = $::os_service_default,
+  $rabbit_hosts                       = $::os_service_default,
+  $rabbit_userid                      = $::os_service_default,
+  $rabbit_password                    = $::os_service_default,
+  $rabbit_virtual_host                = $::os_service_default,
+  $rabbit_ha_queues                   = $::os_service_default,
+  $rabbit_heartbeat_timeout_threshold = $::os_service_default,
+  $rabbit_heartbeat_rate              = $::os_service_default,
   $amqp_durable_queues                = $::os_service_default,
-  $rabbit_use_ssl                     = false,
-  $kombu_ssl_ca_certs                 = undef,
-  $kombu_ssl_certfile                 = undef,
-  $kombu_ssl_keyfile                  = undef,
-  $kombu_ssl_version                  = 'TLSv1',
-  $memcached_servers                  = undef,
+  $rabbit_use_ssl                     = $::os_service_default,
+  $kombu_ssl_ca_certs                 = $::os_service_default,
+  $kombu_ssl_certfile                 = $::os_service_default,
+  $kombu_ssl_keyfile                  = $::os_service_default,
+  $kombu_ssl_version                  = $::os_service_default,
+  $kombu_reconnect_delay              = $::os_service_default,
+  $kombu_compression                  = $::os_service_default,
+  $memcached_servers                  = $::os_service_default,
   # DEPRECATED PARAMETERS
   $alarm_history_time_to_live         = undef,
   $qpid_hostname                      = undef,
@@ -202,19 +215,6 @@ class ceilometer(
   include ::ceilometer::logging
   include ::ceilometer::params
 
-  if $kombu_ssl_ca_certs and !$rabbit_use_ssl {
-    fail('The kombu_ssl_ca_certs parameter requires rabbit_use_ssl to be set to true')
-  }
-  if $kombu_ssl_certfile and !$rabbit_use_ssl {
-    fail('The kombu_ssl_certfile parameter requires rabbit_use_ssl to be set to true')
-  }
-  if $kombu_ssl_keyfile and !$rabbit_use_ssl {
-    fail('The kombu_ssl_keyfile parameter requires rabbit_use_ssl to be set to true')
-  }
-  if ($kombu_ssl_certfile and !$kombu_ssl_keyfile) or ($kombu_ssl_keyfile and !$kombu_ssl_certfile) {
-    fail('The kombu_ssl_certfile and kombu_ssl_keyfile parameters must be used together')
-  }
-
   if $alarm_history_time_to_live {
     warning('alarm_history_time_to_live parameter is deprecated. It should be configured for Aodh.')
   }
@@ -238,105 +238,41 @@ class ceilometer(
   }
 
   # we keep "ceilometer.openstack.common.rpc.impl_kombu" for backward compatibility
-  if $rpc_backend == 'ceilometer.openstack.common.rpc.impl_kombu' or $rpc_backend == 'rabbit' {
-
-    if $rabbit_hosts {
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_host': ensure => absent }
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_port': ensure => absent }
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_hosts':
-        value => join($rabbit_hosts, ',')
-      }
-      } else {
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host }
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port }
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_hosts':
-        value => "${rabbit_host}:${rabbit_port}"
-      }
-    }
-
-    if $rabbit_ha_queues == undef {
-      if size($rabbit_hosts) > 1 {
-        ceilometer_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
-      } else {
-        ceilometer_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
-      }
-    } else {
-      ceilometer_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues }
+  if $rpc_backend in [$::os_service_default, 'ceilometer.openstack.common.rpc.impl_kombu', 'rabbit'] {
+    oslo::messaging::rabbit {'ceilometer_config':
+      rabbit_host                 => $rabbit_host,
+      rabbit_port                 => $rabbit_port,
+      rabbit_hosts                => $rabbit_hosts,
+      rabbit_userid               => $rabbit_userid,
+      rabbit_password             => $rabbit_password,
+      rabbit_virtual_host         => $rabbit_virtual_host,
+      rabbit_ha_queues            => $rabbit_ha_queues,
+      heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
+      heartbeat_rate              => $rabbit_heartbeat_rate,
+      amqp_durable_queues         => $amqp_durable_queues,
+      rabbit_use_ssl              => $rabbit_use_ssl,
+      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,
+      kombu_reconnect_delay       => $kombu_reconnect_delay,
+      kombu_compression           => $kombu_compression,
     }
-
-      ceilometer_config {
-        'oslo_messaging_rabbit/rabbit_userid':                value => $rabbit_userid;
-        'oslo_messaging_rabbit/rabbit_password':              value => $rabbit_password, secret => true;
-        'oslo_messaging_rabbit/rabbit_virtual_host':          value => $rabbit_virtual_host;
-        'oslo_messaging_rabbit/rabbit_use_ssl':               value => $rabbit_use_ssl;
-        'oslo_messaging_rabbit/heartbeat_timeout_threshold':  value => $rabbit_heartbeat_timeout_threshold;
-        'oslo_messaging_rabbit/heartbeat_rate':               value => $rabbit_heartbeat_rate;
-        'oslo_messaging_rabbit/amqp_durable_queues':          value => $amqp_durable_queues;
-      }
-
-      if $rabbit_use_ssl {
-
-      if $kombu_ssl_ca_certs {
-        ceilometer_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; }
-      } else {
-        ceilometer_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent; }
-      }
-
-      if $kombu_ssl_certfile or $kombu_ssl_keyfile {
-        ceilometer_config {
-          'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile;
-          'oslo_messaging_rabbit/kombu_ssl_keyfile':  value => $kombu_ssl_keyfile;
-        }
-      } else {
-        ceilometer_config {
-          'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
-          'oslo_messaging_rabbit/kombu_ssl_keyfile':  ensure => absent;
-        }
-      }
-
-      if $kombu_ssl_version {
-        ceilometer_config { 'oslo_messaging_rabbit/kombu_ssl_version':  value => $kombu_ssl_version; }
-      } else {
-        ceilometer_config { 'oslo_messaging_rabbit/kombu_ssl_version':  ensure => absent; }
-      }
-
-      } else {
-        ceilometer_config {
-          'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
-          'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
-          'oslo_messaging_rabbit/kombu_ssl_keyfile':  ensure => absent;
-          'oslo_messaging_rabbit/kombu_ssl_version':  ensure => absent;
-        }
-      }
-
-  }
-
-  # we keep "ceilometer.openstack.common.rpc.impl_qpid" for backward compatibility
-  if $rpc_backend == 'ceilometer.openstack.common.rpc.impl_qpid' or $rpc_backend == 'qpid' {
-    warning('Qpid driver is removed from Oslo.messaging in the Mitaka release')
+  } else {
+    nova_config { 'DEFAULT/rpc_backend': value => $rpc_backend }
   }
 
   # Once we got here, we can act as an honey badger on the rpc used.
   ceilometer_config {
     'DEFAULT/http_timeout'                : value => $http_timeout;
-    'DEFAULT/rpc_backend'                 : value => $rpc_backend;
     'publisher/metering_secret'           : value => $metering_secret, secret => true;
-    'DEFAULT/notification_topics'         : value => join($notification_topics, ',');
     'database/event_time_to_live'         : value => $event_time_to_live;
     'database/metering_time_to_live'      : value => $metering_time_to_live;
   }
 
-  if $memcached_servers {
-    validate_array($memcached_servers)
-  }
+  oslo::messaging::notifications { 'ceilometer_config': topics => $notification_topics }
 
-  if $memcached_servers {
-    ceilometer_config {
-      'DEFAULT/memcached_servers': value  => join($memcached_servers, ',')
-    }
-  } else {
-    ceilometer_config {
-      'DEFAULT/memcached_servers': ensure => absent;
-    }
+  oslo::cache { 'ceilometer_config':
+    memcache_servers => $memcached_servers,
   }
 }
index 9122f723c3b9b79ba4c88fc2492350d82bb671b8..bbad6b39b5efce4f8b6956e2d7fa653435c0f382 100644 (file)
@@ -119,29 +119,23 @@ class ceilometer::logging(
   $verbose_real  = pick($::ceilometer::verbose,$verbose)
   $debug_real = pick($::ceilometer::debug,$debug)
 
-  if is_service_default($default_log_levels) {
-    $default_log_levels_real = $default_log_levels
-  } else {
-    $default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',')
-  }
-
-  ceilometer_config {
-    'DEFAULT/debug':                         value => $debug_real;
-    'DEFAULT/verbose':                       value => $verbose_real;
-    'DEFAULT/use_stderr':                    value => $use_stderr_real;
-    'DEFAULT/use_syslog':                    value => $use_syslog_real;
-    'DEFAULT/log_dir':                       value => $log_dir_real;
-    'DEFAULT/syslog_log_facility':           value => $log_facility_real;
-    'DEFAULT/logging_context_format_string': value => $logging_context_format_string;
-    'DEFAULT/logging_default_format_string': value => $logging_default_format_string;
-    'DEFAULT/logging_debug_format_suffix':   value => $logging_debug_format_suffix;
-    'DEFAULT/logging_exception_prefix':      value => $logging_exception_prefix;
-    'DEFAULT/log_config_append':             value => $log_config_append;
-    'DEFAULT/default_log_levels':            value => $default_log_levels_real;
-    'DEFAULT/publish_errors':                value => $publish_errors;
-    'DEFAULT/fatal_deprecations':            value => $fatal_deprecations;
-    'DEFAULT/instance_format':               value => $instance_format;
-    'DEFAULT/instance_uuid_format':          value => $instance_uuid_format;
-    'DEFAULT/log_date_format':               value => $log_date_format;
+  oslo::log { 'ceilometer_config':
+    debug                         => $debug_real,
+    verbose                       => $verbose_real,
+    use_stderr                    => $use_stderr_real,
+    use_syslog                    => $use_syslog_real,
+    log_dir                       => $log_dir_real,
+    syslog_log_facility           => $log_facility_real,
+    logging_context_format_string => $logging_context_format_string,
+    logging_default_format_string => $logging_default_format_string,
+    logging_debug_format_suffix   => $logging_debug_format_suffix,
+    logging_exception_prefix      => $logging_exception_prefix,
+    log_config_append             => $log_config_append,
+    default_log_levels            => $default_log_levels,
+    publish_errors                => $publish_errors,
+    fatal_deprecations            => $fatal_deprecations,
+    instance_format               => $instance_format,
+    instance_uuid_format          => $instance_uuid_format,
+    log_date_format               => $log_date_format,
   }
 }
index e9be473e46052ff4b1f45ada0a8bd6cd34f03f8f..d489190590544f7820b1830b75d085ebf1e3db43 100644 (file)
@@ -26,4 +26,6 @@ class ceilometer::policy (
 
   create_resources('openstacklib::policy::base', $policies)
 
+  oslo::policy { 'ceilometer_config': policy_file => $policy_path }
+
 }
index aa257330e9a01b41d10a3e6288858b0faaa51799..4351f8085f118e65b40f694d3ca15082ce4d4b1d 100644 (file)
@@ -35,6 +35,7 @@
     { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
     { "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.0.0" },
     { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" },
-    { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" }
+    { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" },
+    { "name": "openstack/oslo", "version_requirement": "<9.0.0" }
   ]
 }
diff --git a/releasenotes/notes/switch_to_oslo_everywhere-7412fe9a4dffdf71.yaml b/releasenotes/notes/switch_to_oslo_everywhere-7412fe9a4dffdf71.yaml
new file mode 100644 (file)
index 0000000..2c7c8e3
--- /dev/null
@@ -0,0 +1,5 @@
+---
+features:
+  - Configure oslo related sections using puppet-oslo module.
+    Messaging, database, logging, policy and notification parameters
+    are configured from oslo defines now.
index c56d254466c9acc7f20fdcf6a913369631006043..5b092e902126e6a7e31c13d564dca29a5b39701d 100644 (file)
@@ -26,7 +26,6 @@ describe 'ceilometer::db' do
           :sync_db                 => false }
       end
 
-      it { is_expected.to contain_class('ceilometer::params') }
       it { is_expected.not_to contain_class('ceilometer::db::sync') }
       it { is_expected.to contain_ceilometer_config('database/connection').with_value('mongodb://localhost:1234/ceilometer').with_secret(true) }
       it { is_expected.to contain_ceilometer_config('database/idle_timeout').with_value('3601') }
@@ -52,7 +51,7 @@ describe 'ceilometer::db' do
       end
 
       it 'install the proper backend package' do
-        is_expected.to contain_package('ceilometer-backend-package').with(
+        is_expected.to contain_package('db_backend_package').with(
           :ensure => 'present',
           :name   => 'python-pymongo',
           :tag    => 'openstack'
@@ -104,7 +103,7 @@ describe 'ceilometer::db' do
       end
 
       it 'install the proper backend package' do
-        is_expected.to contain_package('ceilometer-backend-package').with(
+        is_expected.to contain_package('db_backend_package').with(
           :ensure => 'present',
           :name   => 'python-pymysql',
           :tag    => 'openstack'
@@ -118,7 +117,7 @@ describe 'ceilometer::db' do
       end
 
       it 'install the proper backend package' do
-        is_expected.to contain_package('ceilometer-backend-package').with(
+        is_expected.to contain_package('db_backend_package').with(
           :ensure => 'present',
           :name   => 'python-pysqlite2',
           :tag    => 'openstack'
@@ -142,7 +141,7 @@ describe 'ceilometer::db' do
         { :database_connection     => 'mysql+pymysql:///ceilometer:ceilometer@localhost/ceilometer', }
       end
 
-      it { is_expected.not_to contain_package('ceilometer-backend-package') }
+      it { is_expected.not_to contain_package('db_backend_package') }
     end
   end
 
index 55f97ae4f8ed63a61d1bb737301837a83da5adfa..111ec4642832effa113de9996dec1cec235af7fa 100644 (file)
@@ -22,7 +22,6 @@ describe 'ceilometer' do
       :rabbit_port        => 5672,
       :rabbit_userid      => 'guest',
       :rabbit_password    => '',
-      :rabbit_virtual_host => '/',
     }
   end
 
@@ -68,7 +67,7 @@ describe 'ceilometer' do
 
       context("with legacy rpc_backend value") do
         before { params.merge!( rabbit_params ).merge!(:rpc_backend => 'ceilometer.openstack.common.rpc.impl_kombu') }
-        it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('ceilometer.openstack.common.rpc.impl_kombu') }
+        it { is_expected.to contain_ceilometer_config('DEFAULT/rpc_backend').with_value('rabbit') }
       end
     end
 
@@ -114,7 +113,7 @@ describe 'ceilometer' do
     end
 
     it 'configures notification_topics' do
-      is_expected.to contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications')
+      is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications')
     end
 
     context 'with rabbitmq durable queues configured' do
@@ -126,7 +125,7 @@ describe 'ceilometer' do
       before { params.merge!( :notification_topics => ['notifications', 'custom']) }
 
       it 'configures notification_topics' do
-        is_expected.to contain_ceilometer_config('DEFAULT/notification_topics').with_value('notifications,custom')
+        is_expected.to contain_ceilometer_config('oslo_messaging_notifications/topics').with_value('notifications,custom')
       end
     end
   end
@@ -137,15 +136,15 @@ describe 'ceilometer' do
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_userid').with_value( params[:rabbit_userid] )
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE DEFAULT>')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
     end
 
     it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_value( params[:rabbit_host] ) }
     it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_port').with_value( params[:rabbit_port] ) }
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_hosts').with_value( "#{params[:rabbit_host]}:#{params[:rabbit_port]}" ) }
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_hosts').with_value('<SERVICE DEFAULT>') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>') }
 
   end
 
@@ -155,15 +154,15 @@ describe 'ceilometer' do
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_userid').with_value( params[:rabbit_userid] )
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE DEFAULT>')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
     end
 
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') }
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>') }
     it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('<SERVICE DEFAULT>') }
 
   end
 
@@ -180,15 +179,15 @@ describe 'ceilometer' do
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_userid').with_value( params[:rabbit_userid] )
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] )
       is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_password').with_value( params[:rabbit_password] ).with_secret(true)
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value( params[:rabbit_virtual_host] )
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0')
-      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('<SERVICE DEFAULT>')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('<SERVICE DEFAULT>')
+      is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/heartbeat_rate').with_value('<SERVICE DEFAULT>')
     end
 
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') }
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_host').with_value('<SERVICE DEFAULT>') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_port').with_value('<SERVICE DEFAULT>') }
     it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) }
-    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') }
+    it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(true) }
 
   end
   shared_examples_for 'rabbit with durable queues' do
@@ -211,23 +210,23 @@ describe 'ceilometer' do
 
   shared_examples_for 'rabbit with SSL support' do
     context "with default parameters" do
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>') }
     end
 
     context "with SSL enabled with kombu" do
       before { params.merge!(
-        :rabbit_use_ssl     => 'true',
+        :rabbit_use_ssl     => true,
         :kombu_ssl_ca_certs => '/path/to/ca.crt',
         :kombu_ssl_certfile => '/path/to/cert.crt',
         :kombu_ssl_keyfile  => '/path/to/cert.key',
         :kombu_ssl_version  => 'TLSv1'
       ) }
 
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) }
       it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/path/to/ca.crt') }
       it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/path/to/cert.crt') }
       it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/path/to/cert.key') }
@@ -236,14 +235,14 @@ describe 'ceilometer' do
 
     context "with SSL enabled without kombu" do
       before { params.merge!(
-        :rabbit_use_ssl     => 'true'
+        :rabbit_use_ssl  => true
       ) }
 
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
-      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(true) }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>') }
+      it { is_expected.to contain_ceilometer_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>') }
     end
 
     context "with SSL wrongly configured" do