diff --git a/deployment/puppet/ceph/manifests/radosgw.pp b/deployment/puppet/ceph/manifests/radosgw.pp index af497984c7..093342e84f 100644 --- a/deployment/puppet/ceph/manifests/radosgw.pp +++ b/deployment/puppet/ceph/manifests/radosgw.pp @@ -212,7 +212,7 @@ class ceph::radosgw ( exec { "Populate ${radosgw_auth_key} keyring": command => "ceph auth get-or-create ${radosgw_auth_key} > ${keyring_path}", - creates => $keyring_path + creates => $keyring_path, } exec { "Create ${rgw_large_pool_name} pool": @@ -222,6 +222,11 @@ class ceph::radosgw ( file { $keyring_path: mode => '0640', } + file {"${rgw_data}/ceph-${rgw_id}/done": + ensure => present, + mode => '0644', + } + Ceph_conf <||> -> Package<| title == 'httpd' |> -> Package[[$::ceph::params::package_radosgw, @@ -238,6 +243,7 @@ class ceph::radosgw ( $rgw_log_file,]] -> Exec["ceph create ${radosgw_auth_key}"] -> Exec["Populate ${radosgw_auth_key} keyring"] -> + File["${rgw_data}/ceph-${rgw_id}/done"] -> File[$keyring_path] -> Exec["Create ${rgw_large_pool_name} pool"] -> Firewall['012 RadosGW allow'] ~> diff --git a/deployment/puppet/osnailyfacter/modular/ceph/enable_rados.pp b/deployment/puppet/osnailyfacter/modular/ceph/enable_rados.pp index e9ebbab508..eec46f27d3 100644 --- a/deployment/puppet/osnailyfacter/modular/ceph/enable_rados.pp +++ b/deployment/puppet/osnailyfacter/modular/ceph/enable_rados.pp @@ -1,17 +1,40 @@ +notice('MODULAR: ceph/enable_rados.pp') + include ::ceph::params -$radosgw_service = $::ceph::params::service_radosgw +$radosgw_service = $::ceph::params::service_radosgw +$radosgw_override_file = '/etc/init/radosgw-all.override' -# ensure the service is running and will start on boot -service { $radosgw_service: - ensure => running, - enable => true, -} - -# The Ubuntu upstart script is incompatible with the upstart provider -# This will force the service to fall back to the debian init script if ($::operatingsystem == 'Ubuntu') { - Service['radosgw'] { - provider => 'debian' + # ensure the service is stopped and will not start on boot + service { 'radosgw': + enable => false, + provider => 'debian', + } + + service { 'radosgw-all': + ensure => running, + enable => true, + provider => 'upstart', + } + + file {$radosgw_override_file: + ensure => present, + mode => '0644', + owner => 'root', + group => 'root', + content => "start on runlevel [2345]\nstop on starting rc RUNLEVEL=[016]\n", + } + + Service['radosgw'] -> + File[$radosgw_override_file] ~> + Service['radosgw-all'] +} +else { + service { $radosgw_service: + ensure => running, + enable => true, } } + + diff --git a/tests/noop/spec/hosts/ceph/enable_rados_spec.rb b/tests/noop/spec/hosts/ceph/enable_rados_spec.rb index 069084da9f..3f56b92c81 100644 --- a/tests/noop/spec/hosts/ceph/enable_rados_spec.rb +++ b/tests/noop/spec/hosts/ceph/enable_rados_spec.rb @@ -5,22 +5,38 @@ manifest = 'ceph/enable_rados.pp' describe manifest do shared_examples 'catalog' do it "should contain radowgw service" do - case facts[:operatingsystem] - when 'Ubuntu' - service_name = 'radosgw' - when 'CentOS' - service_name = 'ceph-radosgw' - end - should contain_service(service_name).with( - 'ensure' => 'running', - 'enable' => 'true' - ) + if facts[:operatingsystem] == 'Ubuntu' + should contain_service('radosgw').with( + :enable => 'false', + :provider => 'debian' + ) - if (facts[:operatingsystem] == 'Ubuntu') - should contain_service(service_name).with_provider('debian') + should contain_service('radosgw-all').with( + :ensure => 'running', + :enable => 'true', + :provider => 'upstart' + ) + else + should contain_service('ceph-radosgw').with( + :ensure => 'running', + :enable => 'true' + ) end end + + it "should create radosgw init override file on Ubuntu" do + if facts[:operatingsystem] == 'Ubuntu' + should contain_file("/etc/init/radosgw-all.override").with( + :ensure => 'present', + :mode => '0644', + :owner => 'root', + :group => 'root', + :content => "start on runlevel [2345]\nstop on starting rc RUNLEVEL=[016]\n" + + ) + end + end end test_ubuntu_and_centos manifest