From 10f2d4aa497240e74cf3792c38978ef87182e6f2 Mon Sep 17 00:00:00 2001 From: David Gurtner Date: Wed, 28 May 2014 16:44:51 +0200 Subject: [PATCH] Remove unnecessary if statement in ceph::mon A previous patchset implementing RedHat family support for ceph::mon had an erroneous if statement in the OS selection code. This is fixed here, in its own patchset though, as changes to the previous patchset failed the CI tests (and even crashed the test infrastructure as it got stuck indefinitely.) The removal of the if statement requires some changes in the tests as well. Also added a check for the exec in RedHat family. Change-Id: I38fbf189c806a21c40bb55dd47d6debb3a592b89 --- manifests/mon.pp | 4 +--- spec/classes/ceph_mons_spec.rb | 3 +++ spec/defines/ceph_mon_spec.rb | 8 +++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/manifests/mon.pp b/manifests/mon.pp index 43c35d7e..22c864d7 100644 --- a/manifests/mon.pp +++ b/manifests/mon.pp @@ -85,9 +85,7 @@ define ceph::mon ( status => "service ceph status mon.${id}", } } else { - if ! $public_addr { - fail("operatingsystem = ${::operatingsystem} is not supported") - } + fail("operatingsystem = ${::operatingsystem} is not supported") } $mon_service = "ceph-mon-${id}" diff --git a/spec/classes/ceph_mons_spec.rb b/spec/classes/ceph_mons_spec.rb index a40594ea..fbac98c4 100644 --- a/spec/classes/ceph_mons_spec.rb +++ b/spec/classes/ceph_mons_spec.rb @@ -49,6 +49,7 @@ describe 'ceph::mons' do describe 'Ubuntu' do let :facts do { + :osfamily => 'Debian', :operatingsystem => 'Ubuntu', } end @@ -59,6 +60,7 @@ describe 'ceph::mons' do describe 'Debian' do let :facts do { + :osfamily => 'Debian', :operatingsystem => 'Debian', } end @@ -69,6 +71,7 @@ describe 'ceph::mons' do describe 'RedHat' do let :facts do { + :osfamily => 'RedHat', :operatingsystem => 'RedHat', } end diff --git a/spec/defines/ceph_mon_spec.rb b/spec/defines/ceph_mon_spec.rb index f421a17b..c3817f4a 100644 --- a/spec/defines/ceph_mon_spec.rb +++ b/spec/defines/ceph_mon_spec.rb @@ -28,6 +28,7 @@ describe 'ceph::mon' do let :facts do { + :osfamily => 'Debian', :operatingsystem => 'Ubuntu', } end @@ -61,8 +62,8 @@ touch /etc/ceph/ceph.client.admin.keyring" let :facts do { + :osfamily => 'RedHat', :operatingsystem => 'RHEL6', - :hostname => 'first', } end @@ -78,6 +79,11 @@ touch /etc/ceph/ceph.client.admin.keyring" end it { should contain_service('ceph-mon-A').with('ensure' => "running") } + it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with( + 'command' => "/bin/true # comment to satisfy puppet syntax requirements +set -ex +touch /etc/ceph/ceph.client.admin.keyring" + ) } # it { p subject.resources }