From 3cf985f57ef6f12a09fc4bdb0ad038814dd42db0 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Thu, 9 Mar 2017 09:25:07 +0800 Subject: [PATCH] Inconsistent package_ensure parameter name The parameter name used to enforce package state is inconsistent across manifests and modules. I settle on package_ensure since it's already widely used. Change-Id: I887e924d184d9b25c33b5fe617d82f170d0cee34 Closes-Bug: #1668732 --- manifests/api.pp | 66 ++++++++++++------- manifests/conductor.pp | 46 ++++++++----- manifests/generic_service.pp | 22 ++++++- manifests/guestagent.pp | 19 +++++- manifests/taskmanager.pp | 19 +++++- ...re_package_parameter-843952a793d67911.yaml | 12 ++++ spec/shared_examples.rb | 2 +- 7 files changed, 136 insertions(+), 50 deletions(-) create mode 100644 releasenotes/notes/deprecate_ensure_package_parameter-843952a793d67911.yaml diff --git a/manifests/api.pp b/manifests/api.pp index 3da0bbc4..ba716a23 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -25,7 +25,7 @@ # (optional) Whether to start/stop the service # Defaults to true # -# [*ensure_package*] +# [*package_ensure*] # (optional) Whether the trove api package will be installed # Defaults to 'present' # @@ -116,30 +116,38 @@ # (optional) The strategy to use for authentication. # Defaults to 'keystone' # +# DEPRECATED PARAMETERS +# +# [*ensure_package*] +# (optional) Whether the trove api package will be installed +# Defaults to undef +# class trove::api( - $debug = undef, - $log_file = undef, - $log_dir = undef, - $use_syslog = undef, - $use_stderr = undef, - $log_facility = undef, - $bind_host = '0.0.0.0', - $bind_port = '8779', - $backlog = '4096', - $workers = $::os_workers, - $enabled = true, - $purge_config = false, - $cert_file = false, - $key_file = false, - $ca_file = false, - $http_get_rate = 200, - $http_post_rate = 200, - $http_put_rate = 200, - $http_delete_rate = 200, - $http_mgmt_post_rate = 200, - $manage_service = true, - $ensure_package = 'present', - $auth_strategy = 'keystone', + $debug = undef, + $log_file = undef, + $log_dir = undef, + $use_syslog = undef, + $use_stderr = undef, + $log_facility = undef, + $bind_host = '0.0.0.0', + $bind_port = '8779', + $backlog = '4096', + $workers = $::os_workers, + $enabled = true, + $purge_config = false, + $cert_file = false, + $key_file = false, + $ca_file = false, + $http_get_rate = 200, + $http_post_rate = 200, + $http_put_rate = 200, + $http_delete_rate = 200, + $http_mgmt_post_rate = 200, + $manage_service = true, + $package_ensure = 'present', + $auth_strategy = 'keystone', + # DEPRECATED PARAMETERS + $ensure_package = undef, ) inherits trove { include ::trove::deps @@ -148,6 +156,14 @@ class trove::api( include ::trove::logging include ::trove::params + if $ensure_package { + warning("trove::api::ensure_package is deprecated and will be removed in \ +the future release. Please use trove::api::package_ensure instead.") + $package_ensure_real = $ensure_package + } else { + $package_ensure_real = $package_ensure + } + # basic service config trove_config { 'DEFAULT/bind_host': value => $bind_host; @@ -283,7 +299,7 @@ class trove::api( trove::generic_service { 'api': enabled => $enabled, manage_service => $manage_service, - ensure_package => $ensure_package, + package_ensure => $package_ensure_real, package_name => $::trove::params::api_package_name, service_name => $::trove::params::api_service_name, } diff --git a/manifests/conductor.pp b/manifests/conductor.pp index d378f1c2..a68cb303 100644 --- a/manifests/conductor.pp +++ b/manifests/conductor.pp @@ -12,7 +12,7 @@ # (optional) Whether to start/stop the service # Defaults to true # -# [*ensure_package*] +# [*package_ensure*] # (optional) The state of the trove conductor package # Defaults to 'present' # @@ -58,25 +58,41 @@ # (optional) If False doesn't trace SQL requests. # Default: $::os_service_default # +# DEPRECATED PARAMETERS +# +# [*ensure_package*] +# (optional) The state of the trove conductor package +# Defaults to undef +# class trove::conductor( - $enabled = true, - $manage_service = true, - $ensure_package = '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, - $auth_url = 'http://localhost:5000/v2.0', - $conductor_manager = 'trove.conductor.manager.Manager', - $workers = $::os_workers, - $enable_profiler = $::os_service_default, - $trace_sqlalchemy = $::os_service_default, + $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, + $auth_url = 'http://localhost:5000/v2.0', + $conductor_manager = 'trove.conductor.manager.Manager', + $workers = $::os_workers, + $enable_profiler = $::os_service_default, + $trace_sqlalchemy = $::os_service_default, + # DEPRECATED PARAMETERS + $ensure_package = undef, ) inherits trove { include ::trove::deps include ::trove::params + if $ensure_package { + warning("trove::conductor::ensure_package is deprecated and will be removed in \ +the future release. Please use trove::conductor::package_ensure instead.") + $package_ensure_real = $ensure_package + } else { + $package_ensure_real = $package_ensure + } + if $::trove::database_connection { if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { require '::mysql::bindings' @@ -175,7 +191,7 @@ class trove::conductor( manage_service => $manage_service, package_name => $::trove::params::conductor_package_name, service_name => $::trove::params::conductor_service_name, - ensure_package => $ensure_package, + package_ensure => $package_ensure_real, } } diff --git a/manifests/generic_service.pp b/manifests/generic_service.pp index d612ca15..93987bca 100644 --- a/manifests/generic_service.pp +++ b/manifests/generic_service.pp @@ -43,16 +43,24 @@ # (optional) Manage or not the service (if a service_name is provided). # Defaults to true. # -# [*ensure_package*] +# [*package_ensure*] # (optional) Control the ensure parameter for the package ressource. # Defaults to 'present'. # +# DEPRECATED PARAMETERS +# +# [*ensure_package*] +# (optional) Control the ensure parameter for the package ressource. +# Defaults to undef. +# define trove::generic_service( $package_name, $service_name, $enabled = false, $manage_service = true, - $ensure_package = 'present' + $package_ensure = 'present', + # DEPRECATED PARAMETERS + $ensure_package = undef ) { include ::trove::deps @@ -60,10 +68,18 @@ define trove::generic_service( $trove_title = "trove-${name}" + if $ensure_package { + warning("trove::generic_service::ensure_package is deprecated and will be removed \ +in the future release. Please use trove::generic_service::package_ensure instead.") + $package_ensure_real = $ensure_package + } else { + $package_ensure_real = $package_ensure + } + if ($package_name) { if !defined(Package[$package_name]) { package { $trove_title: - ensure => $ensure_package, + ensure => $package_ensure_real, name => $package_name, tag => ['openstack', 'trove-package'], } diff --git a/manifests/guestagent.pp b/manifests/guestagent.pp index ed7876a0..32185bdd 100644 --- a/manifests/guestagent.pp +++ b/manifests/guestagent.pp @@ -12,7 +12,7 @@ # (optional) Whether to start/stop the service # Defaults to true # -# [*ensure_package*] +# [*package_ensure*] # (optional) The state of the trove guest agent package # Defaults to 'present' # @@ -107,10 +107,14 @@ # guests need to talk to the rabbit cluster via # a different port. # +# [*ensure_package*] +# (optional) The state of the trove guest agent package +# Defaults to undef +# class trove::guestagent( $enabled = true, $manage_service = true, - $ensure_package = 'present', + $package_ensure = 'present', $debug = $::os_service_default, $log_file = '/var/log/trove/trove-guestagent.log', $log_dir = '/var/log/trove', @@ -130,6 +134,7 @@ class trove::guestagent( $rabbit_hosts = $::trove::rabbit_hosts, $rabbit_host = $::trove::rabbit_host, $rabbit_port = $::trove::rabbit_port, + $ensure_package = undef, ) inherits trove { include ::trove::deps @@ -143,6 +148,14 @@ and trove::guestagent::rabbit_port are deprecated. Please use \ trove::guestagent::default_transport_url instead.") } + if $ensure_package { + warning("trove::guestagent::ensure_package is deprecated and will be removed \ +in the future release. Please use trove::guestagent::package_ensure instead.") + $package_ensure_real = $ensure_package + } else { + $package_ensure_real = $package_ensure + } + if $control_exchange { warning("control_exchange parameter is deprecated. Please use \ trove::control_exchange instead.") @@ -234,7 +247,7 @@ trove::control_exchange instead.") manage_service => $manage_service, package_name => $::trove::params::guestagent_package_name, service_name => $::trove::params::guestagent_service_name, - ensure_package => $ensure_package, + package_ensure => $package_ensure_real, } } diff --git a/manifests/taskmanager.pp b/manifests/taskmanager.pp index 8c3cb721..72078ca2 100644 --- a/manifests/taskmanager.pp +++ b/manifests/taskmanager.pp @@ -29,7 +29,7 @@ # (optional) Whether to start/stop the service # Defaults to true # -# [*ensure_package*] +# [*package_ensure*] # (optional) The state of the trove taskmanager package # Defaults to 'present' # @@ -90,6 +90,10 @@ # (optional) Use template to provision trove guest agent configuration file. # Defaults to true. # +# [*ensure_package*] +# (optional) The state of the trove taskmanager package +# Defaults to undef +# class trove::taskmanager( $enabled = true, $manage_service = true, @@ -101,18 +105,27 @@ class trove::taskmanager( $log_facility = $::os_service_default, $auth_url = 'http://localhost:5000/v2.0', $heat_url = false, - $ensure_package = 'present', + $package_ensure = 'present', $guestagent_config_file = '/etc/trove/trove-guestagent.conf', $default_neutron_networks = undef, $taskmanager_queue = 'taskmanager', $taskmanager_manager = 'trove.taskmanager.manager.Manager', #DEPRECATED OPTIONS $use_guestagent_template = true, + $ensure_package = undef, ) inherits trove { include ::trove::deps include ::trove::params + if $ensure_package { + warning("trove::taskmanager::ensure_package is deprecated and will be removed in \ +the future release. Please use trove::taskmanager::package_ensure instead.") + $package_ensure_real = $ensure_package + } else { + $package_ensure_real = $package_ensure + } + if $::trove::database_connection { if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { require '::mysql::bindings' @@ -253,7 +266,7 @@ class trove::taskmanager( manage_service => $manage_service, package_name => $::trove::params::taskmanager_package_name, service_name => $::trove::params::taskmanager_service_name, - ensure_package => $ensure_package, + package_ensure => $package_ensure_real, } if $guestagent_config_file { diff --git a/releasenotes/notes/deprecate_ensure_package_parameter-843952a793d67911.yaml b/releasenotes/notes/deprecate_ensure_package_parameter-843952a793d67911.yaml new file mode 100644 index 00000000..56483cc6 --- /dev/null +++ b/releasenotes/notes/deprecate_ensure_package_parameter-843952a793d67911.yaml @@ -0,0 +1,12 @@ +--- +deprecations: + - trove::generic_service::ensure_package is now deprecated and will be removed + in the future release. Please use trove::generic_service::package_ensure instead. + - trove::taskmanager::ensure_package is now deprecated and will be removed + in the future release. Please use trove::taskmanager::package_ensure instead. + - trove::api::ensure_package is now deprecated and will be removed + in the future release. Please use trove::api::package_ensure instead. + - trove::conductor::ensure_package is now deprecated and will be removed + in the future release. Please use trove::conductor::package_ensure instead. + - trove::guestagent::ensure_package is now deprecated and will be removed + in the future release. Please use trove::guestagent::package_ensure instead. diff --git a/spec/shared_examples.rb b/spec/shared_examples.rb index 01ee5f79..083b33f7 100644 --- a/spec/shared_examples.rb +++ b/spec/shared_examples.rb @@ -27,7 +27,7 @@ shared_examples 'generic trove service' do |service| context 'with overridden parameters' do let :params do { :enabled => true, - :ensure_package => '2014.1-1' } + :package_ensure => '2014.1-1' } end it 'installs package and service' do