Skip to content

Commit

Permalink
Add parameter to manage packages in rbd backend
Browse files Browse the repository at this point in the history
Some of us may install python-ceph package with other module.
With this new 'manage_packages' parameter, we can avoid an duplicate
package declaration when it's done in an other part of puppet code.

Default behavior is not changed (package will still be installed).

Change-Id: I75ffa9c3dd05ea31f41b032f4778f967b1c6d974
Signed-off-by: Arnaud Morin <arnaud.morin@corp.ovh.com>
  • Loading branch information
arnaudmorin committed Apr 26, 2017
1 parent 53d268a commit 4aef3d9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 17 deletions.
41 changes: 24 additions & 17 deletions manifests/backend/rbd.pp
Expand Up @@ -21,31 +21,36 @@ # == class: glance::backend::rbd
# Optional. Enables direct COW from glance to rbd
# DEPRECATED, use show_image_direct_url in glance::api
#
# [*manage_packages*]
# Optional. Whether we should manage the packages.
# Defaults to true,
#
# [*package_ensure*]
# (optional) Desired ensure state of packages.
# accepts latest or specific versions.
# Defaults to present.
# Optional. Desired ensure state of packages.
# accepts latest or specific versions.
# Defaults to present.
#
# [*rados_connect_timeout*]
# Optinal. Timeout value (in seconds) used when connecting
# to ceph cluster. If value <= 0, no timeout is set and
# default librados value is used.
# Default: $::os_service_default.
# Optinal. Timeout value (in seconds) used when connecting
# to ceph cluster. If value <= 0, no timeout is set and
# default librados value is used.
# Default: $::os_service_default.
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
# [*multi_store*]
# Optional. Boolean describing if multiple backends will be configured
# Defaults to false
#
# [*glare_enabled*]
# (optional) Whether enabled Glance Glare API.
# Defaults to false
# [*glare_enabled*]
# Optional. Whether enabled Glance Glare API.
# Defaults to false
#
class glance::backend::rbd(
$rbd_store_user = $::os_service_default,
$rbd_store_ceph_conf = $::os_service_default,
$rbd_store_pool = $::os_service_default,
$rbd_store_chunk_size = $::os_service_default,
$show_image_direct_url = undef,
$manage_packages = true,
$package_ensure = 'present',
$rados_connect_timeout = $::os_service_default,
$multi_store = false,
Expand Down Expand Up @@ -84,10 +89,12 @@ # == class: glance::backend::rbd
}
}

package { 'python-ceph':
ensure => $package_ensure,
name => $::glance::params::pyceph_package_name,
tag => 'glance-support-package',
if $manage_packages {
package { 'python-ceph':
ensure => $package_ensure,
name => $::glance::params::pyceph_package_name,
tag => 'glance-support-package',
}
}

}
9 changes: 9 additions & 0 deletions spec/classes/glance_backend_rbd_spec.rb
Expand Up @@ -78,4 +78,13 @@
)
}
end

describe 'when not managing packages' do
let :params do
{
:manage_packages => false,
}
end
it { is_expected.not_to contain_package('python-ceph') }
end
end

0 comments on commit 4aef3d9

Please sign in to comment.