Merge "Support for RedHat in ceph::mon"

This commit is contained in:
Jenkins
2014-05-29 08:09:30 +00:00
committed by Gerrit Code Review
8 changed files with 443 additions and 281 deletions

View File

@@ -1,6 +1,7 @@
#
# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) iWeb Technologies Inc.
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,6 +17,7 @@
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Moreau Simard <dmsimard@iweb.com>
# Author: David Gurtner <david@nine.ch>
#
# Installs and configures MONs (ceph monitors)
### == Parameters
@@ -74,7 +76,7 @@ define ceph::mon (
stop => "stop ceph-mon id=${id}",
status => "status ceph-mon id=${id}",
}
} elsif $::operatingsystem == 'Debian' {
} elsif ($::operatingsystem == 'Debian') or ($::osfamily == 'RedHat') {
$init = 'sysvinit'
Service {
name => "ceph-mon-${id}",
@@ -83,10 +85,9 @@ define ceph::mon (
status => "service ceph status mon.${id}",
}
} else {
#
# TODO: create [mon.$id] in ceph.conf for init scripts that require it
#
fail("operatingsystem = ${::operatingsystem} is not supported")
if ! $public_addr {
fail("operatingsystem = ${::operatingsystem} is not supported")
}
}
$mon_service = "ceph-mon-${id}"
@@ -146,7 +147,9 @@ fi
->
# prevent automatic creation of the client.admin key by ceph-create-keys
exec { "ceph-mon-${cluster_name}.client.admin.keyring-${id}":
command => "/usr/bin/touch /etc/ceph/${cluster_name}.client.admin.keyring",
command => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/${cluster_name}.client.admin.keyring",
}
->
service { $mon_service:

View File

@@ -1,5 +1,6 @@
#
# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,41 +15,66 @@
# limitations under the License.
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <david@nine.ch>
#
require 'spec_helper'
describe 'ceph::mons' do
let :facts do
{
:operatingsystem => 'Ubuntu',
shared_examples_for 'ceph mons' do
let :params do
{
:args => {
'A' => {
'public_addr' => '1.2.3.4',
'authentication_type' => 'none',
},
'B' => {
'public_addr' => '1.2.3.4',
'authentication_type' => 'none',
},
},
:defaults => {
'cluster' => 'CLUSTER',
},
}
end
it {
should contain_service('ceph-mon-A').with('ensure' => "running")
should contain_service('ceph-mon-B').with('ensure' => "running")
}
end
let :params do
{
:args => {
'A' => {
'public_addr' => '1.2.3.4',
'authentication_type' => 'none',
},
'B' => {
'public_addr' => '1.2.3.4',
'authentication_type' => 'none',
},
},
:defaults => {
'cluster' => 'CLUSTER',
},
}
describe 'Ubuntu' do
let :facts do
{
:operatingsystem => 'Ubuntu',
}
end
it_configures 'ceph mons'
end
it {
should contain_service('ceph-mon-A').with('ensure' => "running")
should contain_service('ceph-mon-B').with('ensure' => "running")
}
describe 'Debian' do
let :facts do
{
:operatingsystem => 'Debian',
}
end
# it { p subject.resources }
it_configures 'ceph mons'
end
describe 'RedHat' do
let :facts do
{
:operatingsystem => 'RedHat',
}
end
it_configures 'ceph mons'
end
end

View File

@@ -1,5 +1,6 @@
# Copyright (C) 2013 Cloudwatt <libre.licensing@cloudwatt.com>
# Copyright (C) iWeb Technologies Inc.
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,7 +16,8 @@
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Moreau Simard <dmsimard@iweb.com>
# Author: David Gurtner <david@nine.ch>
#
require 'spec_helper'
describe 'ceph::mon' do
@@ -43,9 +45,40 @@ describe 'ceph::mon' do
it { should contain_service('ceph-mon-A').with('ensure' => "running") }
it { should contain_exec('ceph-mon-ceph.client.admin.keyring-A').with(
'command' => "/usr/bin/touch /etc/ceph/ceph.client.admin.keyring"
'command' => "/bin/true # comment to satisfy puppet syntax requirements
set -ex
touch /etc/ceph/ceph.client.admin.keyring"
) }
# it { p subject.resources }
end
end
describe 'Redhat Family' do
describe "with custom params" do
let :facts do
{
:operatingsystem => 'RHEL6',
:hostname => 'first',
}
end
let :title do
'A'
end
let :params do
{
:public_addr => '127.0.0.1',
:authentication_type => 'none',
}
end
it { should contain_service('ceph-mon-A').with('ensure' => "running") }
# it { p subject.resources }
end

View File

@@ -1 +1,22 @@
#
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: David Gurtner <david@nine.ch>
#
require 'puppetlabs_spec_helper/module_spec_helper'
RSpec.configure do |c|
c.alias_it_should_behave_like_to(:it_configures, 'configures')
end

View File

@@ -1,7 +1,9 @@
#
# Copyright 2013 Cloudwatt <libre-licensing@cloudwatt.com>
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <david@nine.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -42,6 +44,15 @@ RSpec.configure do |c|
:node => vm)
shell(:command => 'puppet module install --version 1.4.0 puppetlabs/apt',
:node => vm)
# Flush the firewall
flushfw = <<-EOS
iptables -F
iptables -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
EOS
shell(:node => vm, :command => flushfw)
end
end
end

View File

@@ -1,6 +1,7 @@
#
# Copyright (C) 2014 Catalyst IT Limited.
# Copyright (C) 2014 Cloudwatt <libre-licensing@cloudwatt.com>
# Copyright (C) 2014 Nine Internet Solutions AG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,50 +17,84 @@
#
# Author: Ricardo Rocha <ricardo@catalyst.net.nz>
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <david@nine.ch>
#
require 'spec_helper_system'
describe 'ceph::key' do
purge = <<-EOS
ceph::mon { 'a': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/etc/ceph/ceph.client.admin.keyring',
]:
ensure => absent
}
->
package { [
'python-ceph',
'ceph-common',
'librados2',
'librbd1',
]:
ensure => purged
}
EOS
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'cuttlefish', 'dumpling', 'emperor' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
admin_key = 'AQA0TVRTsP/aHxAAFBvntu1dSEJHxtJeFFrRsg=='
volume_key = 'AQAMTVRTSOHmHBAAH5d1ukHrAnxuSbrWSv9KGA=='
something_key = 'AQD44lJTqGB4LhAA3zV8mKlO9UKFNLwg2f3lvQ=='
mon_host = '$::ipaddress_eth1'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
releases.each do |release|
purge = <<-EOS
ceph::mon { 'a': ensure => absent }
->
file { [
'/var/lib/ceph/bootstrap-osd/ceph.keyring',
'/etc/ceph/ceph.client.admin.keyring',
'/etc/ceph/ceph.client.volume',
]:
ensure => absent
}
->
package { [
'python-ceph',
'ceph-common',
'librados2',
'librbd1',
'libcephfs1',
]:
ensure => purged
}
EOS
describe release do
it 'should install and not inject client.admin key' do
before(:all) do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
->
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
r.exit_code.should_not == 1
end
end
end
after(:all) do
pp = <<-EOS
package { #{packages}:
ensure => purged
}
class { 'ceph::repo':
release => '#{release}',
ensure => absent,
}
EOS
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
r.exit_code.should_not == 1
end
end
end
it 'should install and not inject client.admin key' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => $::ipaddress_eth0,
mon_host => #{mon_host},
authentication_type => 'none',
}
->
@@ -75,7 +110,7 @@ describe 'ceph::key' do
}
->
ceph::mon { 'a':
public_addr => $::ipaddress_eth0,
public_addr => #{mon_host},
authentication_type => 'none',
}
EOS
@@ -110,24 +145,26 @@ describe 'ceph::key' do
r.exit_code.should_not == 1
end
end
end
end
releases.each do |release|
describe release do
it 'should install and inject client.volumes key' do
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
nogroup = 'nogroup'
end
if osfamily == 'RedHat'
nogroup = 'nobody'
end
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
->
class { 'ceph':
fsid => '#{fsid}',
mon_host => $::ipaddress_eth0,
mon_host => #{mon_host},
}
->
ceph::mon { 'a':
public_addr => $::ipaddress_eth0,
public_addr => #{mon_host},
key => '#{mon_key}',
}
->
@@ -148,7 +185,7 @@ describe 'ceph::key' do
cap_osd => 'allow rw',
mode => 0600,
user => 'nobody',
group => 'nogroup',
group => '#{nogroup}',
inject => true,
}
EOS
@@ -166,7 +203,7 @@ describe 'ceph::key' do
end
shell 'ls -l /etc/ceph/ceph.client.volumes.keyring' do |r|
r.stdout.should =~ /.*-rw-------.*nobody\snogroup.*/m
r.stdout.should =~ /.*-rw-------.*nobody\s#{nogroup}.*/m
r.stderr.should be_empty
r.exit_code.should be_zero
end
@@ -176,7 +213,6 @@ describe 'ceph::key' do
r.stderr.should be_empty
r.exit_code.should be_zero
end
end
it 'should uninstall one monitor and all packages' do
@@ -186,12 +222,11 @@ describe 'ceph::key' do
end
end
end
end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-ubuntu-server-12042-x64
# cd .rspec_system/vagrant_projects/one-ubuntu-server-12042-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
@@ -199,7 +234,7 @@ end
# MACHINES=first \
# RELEASES=cuttlefish \
# RS_DESTROY=no \
# RS_SET=two-ubuntu-server-12042-x64 \
# RS_SET=one-centos-64-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_key_spec.rb &&
# git checkout Gemfile

View File

@@ -1,7 +1,9 @@
#
# Copyright 2013,2014 Cloudwatt <libre-licensing@cloudwatt.com>
# Copyright (C) Nine Internet Solutions AG
#
# Author: Loic Dachary <loic@dachary.org>
# Author: David Gurtner <david@nine.ch>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,262 +21,292 @@ require 'spec_helper_system'
describe 'ceph::mon' do
purge = <<-EOS
package { [
'python-ceph',
'ceph-common',
'librados2',
'librbd1',
]:
ensure => purged
}
EOS
releases = ENV['RELEASES'] ? ENV['RELEASES'].split : [ 'cuttlefish', 'dumpling', 'emperor' ]
machines = ENV['MACHINES'] ? ENV['MACHINES'].split : [ 'first', 'second' ]
fsid = 'a4807c9a-e76f-4666-a297-6d6cbc922e3a'
mon_host = '$::ipaddress_eth1'
# passing it directly as unqoted array is not supported everywhere
packages = "[ 'python-ceph', 'ceph-common', 'librados2', 'librbd1', 'libcephfs1' ]"
releases.each do |release|
describe release, :cephx do
it 'should install one monitor with cephx and key' do
describe release do
before(:all) do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
->
class { 'ceph':
fsid => '#{fsid}',
mon_host => $::ipaddress_eth0,
}
->
ceph::mon { 'a':
public_addr => $::ipaddress_eth0,
key => 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw==',
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
shell 'test -z "$(cat /etc/ceph/ceph.client.admin.keyring)"' do |r|
r.exit_code.should be_zero
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
r.exit_code.should_not == 1
end
end
end
it 'should uninstall one monitor' do
after(:all) do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
package { #{packages}:
ensure => purged
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
shell 'status ceph-mon id=a' do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.a/
r.exit_code.should_not be_zero
end
end
it 'should purge all packages' do
puppet_apply(purge) do |r|
r.exit_code.should_not == 1
end
end
end
end
releases.each do |release|
describe release do
it 'should install one monitor with cephx and keyring' do
key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
keyring = "[mon.]\\n\\tkey = #{key}\\n\\tcaps mon = \"allow *\""
keyring_path = "/tmp/keyring"
shell "echo -e '#{keyring}' > #{keyring_path}"
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
->
class { 'ceph':
fsid => '#{fsid}',
mon_host => $::ipaddress_eth0,
}
->
ceph::mon { 'a':
public_addr => $::ipaddress_eth0,
keyring => '#{keyring_path}',
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
shell 'test -f /etc/ceph/ceph.client.admin.keyring' do |r|
r.exit_code.should be_zero
machines.each do |mon|
puppet_apply(:node => mon, :code => pp) do |r|
r.exit_code.should_not == 1
end
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
shell 'status ceph-mon id=a' do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.a/
r.exit_code.should_not be_zero
end
end
it 'should purge all packages' do
puppet_apply(purge) do |r|
r.exit_code.should_not == 1
end
end
end
end
releases.each do |release|
describe release do
it 'should install one monitor no cephx' do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
->
class { 'ceph':
fsid => '#{fsid}',
mon_host => $::ipaddress_eth0,
authentication_type => 'none',
}
->
ceph::mon { 'a':
public_addr => $::ipaddress_eth0,
authentication_type => 'none',
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
shell 'ceph -s' do |r|
r.stdout.should =~ /1 mons at/
r.stderr.should be_empty
r.exit_code.should be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
shell 'status ceph-mon id=a' do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.a/
r.exit_code.should_not be_zero
end
end
it 'should purge all packages' do
puppet_apply(purge) do |r|
r.exit_code.should_not == 1
end
end
end
end
releases.each do |release|
describe release do
it 'should install two monitors, two hosts, no cephx' do
[ 'first', 'second' ].each do |mon|
describe 'on one host' do
it 'should install one monitor' do
pp = <<-EOS
class { 'ceph::repo':
release => '#{release}',
}
->
class { 'ceph':
fsid => '#{fsid}',
mon_host => '10.11.12.2,10.11.12.3',
public_network => '10.11.12.0/24',
authentication_type => 'none',
}
->
ceph::mon { '#{mon}':
authentication_type => 'none',
}
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
authentication_type => 'none',
}
->
ceph::mon { 'a':
public_addr => #{mon_host},
authentication_type => 'none',
}
EOS
puppet_apply(:node => "#{mon}", :code => pp) do |r|
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
shell 'ceph -s' do |r|
r.stdout.should =~ /1 mons at/
r.stderr.should be_empty
r.exit_code.should be_zero
end
end
shell 'ceph -s' do |r|
r.stdout.should =~ /2 mons .* quorum 0,1 first,second/
r.stderr.should be_empty
r.exit_code.should be_zero
end
end
it 'should uninstall two monitors' do
[ 'first', 'second' ].each do |mon|
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { '#{mon}':
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(:node => "#{mon}", :code => pp) do |r|
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
shell "status ceph-mon id=#{mon}" do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.#{mon}/
r.exit_code.should_not be_zero
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.a/
r.exit_code.should_not be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
r.stdout.should =~ /mon.a not found/
r.stderr.should be_empty
r.exit_code.should_not be_zero
end
end
end
end
it 'should purge all packages' do
[ 'first', 'second' ].each do |mon|
puppet_apply(:node => "#{mon}", :code => purge) do |r|
describe 'on one host', :cephx do
it 'should install one monitor with key' do
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
}
->
ceph::mon { 'a':
public_addr => #{mon_host},
key => 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw==',
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
shell 'test -z "$(cat /etc/ceph/ceph.client.admin.keyring)"' do |r|
r.exit_code.should be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.a/
r.exit_code.should_not be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
r.stdout.should =~ /mon.a not found/
r.stderr.should be_empty
r.exit_code.should_not be_zero
end
end
end
it 'should install one monitor with keyring' do
key = 'AQCztJdSyNb0NBAASA2yPZPuwXeIQnDJ9O8gVw=='
keyring = "[mon.]\\n\\tkey = #{key}\\n\\tcaps mon = \"allow *\""
keyring_path = "/tmp/keyring"
shell "echo -e '#{keyring}' > #{keyring_path}"
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => #{mon_host},
}
->
ceph::mon { 'a':
public_addr => #{mon_host},
keyring => '#{keyring_path}',
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
shell 'test -f /etc/ceph/ceph.client.admin.keyring' do |r|
r.exit_code.should be_zero
end
end
it 'should uninstall one monitor' do
pp = <<-EOS
ceph::mon { 'a':
ensure => absent,
}
EOS
puppet_apply(pp) do |r|
r.exit_code.should_not == 1
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell 'status ceph-mon id=a' do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.a/
r.exit_code.should_not be_zero
end
end
if osfamily == 'RedHat'
shell 'service ceph status mon.a' do |r|
r.stdout.should =~ /mon.a not found/
r.stderr.should be_empty
r.exit_code.should_not be_zero
end
end
end
end
describe 'on two hosts' do
it 'should be two hosts' do
machines.size.should == 2
end
it 'should install two monitors' do
machines.each do |mon|
pp = <<-EOS
class { 'ceph':
fsid => '#{fsid}',
mon_host => '10.11.12.2,10.11.12.3',
public_network => '10.11.12.0/24',
authentication_type => 'none',
}
->
ceph::mon { '#{mon}':
public_addr => $::ipaddress_eth1,
authentication_type => 'none',
}
EOS
puppet_apply(:node => mon, :code => pp) do |r|
r.exit_code.should_not == 1
r.refresh
r.exit_code.should_not == 1
end
end
shell 'ceph -s' do |r|
r.stdout.should =~ /2 mons .* quorum 0,1/
r.stderr.should be_empty
r.exit_code.should be_zero
end
end
it 'should uninstall two monitors' do
machines.each do |mon|
pp = <<-EOS
ceph::mon { '#{mon}':
ensure => absent,
}
EOS
puppet_apply(:node => mon, :code => pp) do |r|
r.exit_code.should_not == 1
end
osfamily = facter.facts['osfamily']
operatingsystem = facter.facts['operatingsystem']
if osfamily == 'Debian' && operatingsystem == 'Ubuntu'
shell "status ceph-mon id=#{mon}" do |r|
r.stdout.should be_empty
r.stderr.should =~ /Unknown instance: ceph.#{mon}/
r.exit_code.should_not be_zero
end
end
if osfamily == 'RedHat'
shell "service ceph status mon.#{mon}" do |r|
r.stdout.should =~ /mon.#{mon} not found/
r.stderr.should be_empty
r.exit_code.should_not be_zero
end
end
end
end
end
end
end
end
# Local Variables:
# compile-command: "cd ../..

View File

@@ -144,14 +144,15 @@ end
# Local Variables:
# compile-command: "cd ../..
# (
# cd .rspec_system/vagrant_projects/two-centos-64-x64 &&
# cd .rspec_system/vagrant_projects/one-ubuntu-server-12042-x64
# vagrant destroy --force
# )
# cp -a Gemfile-rspec-system Gemfile
# BUNDLE_PATH=/tmp/vendor bundle install --no-deployment
# RELEASES='cuttlefish dumpling' \
# MACHINES=first \
# RELEASES=cuttlefish \
# RS_DESTROY=no \
# RS_SET=two-centos-64-x64 \
# RS_SET=one-ubuntu-server-12042-x64 \
# BUNDLE_PATH=/tmp/vendor \
# bundle exec rake spec:system SPEC=spec/system/ceph_repo_spec.rb &&
# git checkout Gemfile