[storage/rbd] Fix Ceph::Key[admin] dependency

Ceph admin key is populated by a fact and exported through a exported
resource, a require on Ceph::Key class has no sens here, and this bloc
the run. A better solution is to test if the value is empty and run pool
creation then.

This commit Close #18 and I've successfully tested this on os-ci-test9 !

Please see:
  https://github.com/enovance/puppet-cloud/issues/18
  https://github.com/enovance/openstack-puppet-ci/blob/master/site.pp#L145-L148
  https://github.com/enovance/puppet-ceph/blob/master/lib/facter/ceph_osd_bootstrap_key.rb#L18-L21
This commit is contained in:
Sebastien Badia 2014-01-23 18:46:45 +01:00
parent 07345ba9cc
commit c15e60283b

View File

@ -28,35 +28,32 @@ class cloud::storage::rbd::pools(
if $setup_pools {
# ceph osd pool create poolname 128 128
exec { 'create_glance_images_pool':
command => "rados mkpool ${glance_pool} ${pool_default_pg_num} ${pool_default_pgp_num}",
unless => "rados lspools | grep -sq ${glance_pool}",
require => Ceph::Key['admin'];
}
if !empty($::ceph_admin_key) {
# ceph osd pool create poolname 128 128
exec { 'create_glance_images_pool':
command => "rados mkpool ${glance_pool} ${pool_default_pg_num} ${pool_default_pgp_num}",
unless => "rados lspools | grep -sq ${glance_pool}",
}
exec { 'create_glance_images_user_and_key':
command => "ceph auth get-or-create client.${glance_user} mon 'allow r' \
osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}'",
unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${glance_user}$'",
require => Exec['create_glance_images_pool'];
}
exec { 'create_glance_images_user_and_key':
command => "ceph auth get-or-create client.${glance_user} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}'",
unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${glance_user}$'",
require => Exec['create_glance_images_pool'];
}
# ceph osd pool create poolname 128 128
exec { 'create_cinder_volumes_pool':
command => "rados mkpool ${cinder_pool} ${pool_default_pg_num} ${pool_default_pgp_num}",
unless => "/usr/bin/rados lspools | grep -sq ${cinder_pool}",
}
# ceph osd pool create poolname 128 128
exec { 'create_cinder_volumes_pool':
command => "rados mkpool ${cinder_pool} ${pool_default_pg_num} ${pool_default_pgp_num}",
unless => "/usr/bin/rados lspools | grep -sq ${cinder_pool}",
require => Ceph::Key['admin'];
}
exec { 'create_cinder_volumes_user_and_key':
# TODO: point PG num with a cluster variable
command => "ceph auth get-or-create client.${cinder_user} mon 'allow r' \
osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}, allow rx pool=${cinder_pool}'",
unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${cinder_user}$'",
require => Exec['create_cinder_volumes_pool'];
}
exec { 'create_cinder_volumes_user_and_key':
# TODO: point PG num with a cluster variable
command => "ceph auth get-or-create client.${cinder_user} mon 'allow r' osd 'allow class-read object_prefix rbd_children, allow rwx pool=${glance_pool}, allow rx pool=${cinder_pool}'",
unless => "ceph auth list 2> /dev/null | egrep -sq '^client.${cinder_user}$'",
require => Exec['create_cinder_volumes_pool'];
}
} # !empty($::ceph_admin_key)
# exec { "create cinder backup pool":
# # TODO: point PG num with a cluster variable + keyring