Add ceph::repo and it's unit tests to puppet-ceph
ceph::repo is used to set up official ceph repositories. This commit brings support for the Ubuntu LTS and Debian operating systems. It also allows the cuttlefish and the dumpling release of Ceph. Redhat-like support is planned. Closes-bug: #1243348 Change-Id: I667acebdd94d0644006e5775962a25e6280e6896
This commit is contained in:
parent
66e7d71d15
commit
c15e3fcc6f
@ -1,5 +1,8 @@
|
||||
fixtures:
|
||||
repositories:
|
||||
'stdlib': 'git://github.com/puppetlabs/puppetlabs-stdlib'
|
||||
'apt':
|
||||
repo: 'git://github.com/puppetlabs/puppetlabs-apt.git'
|
||||
ref: '1.4.0'
|
||||
symlinks:
|
||||
'ceph': "#{source_dir}"
|
||||
|
@ -2,4 +2,8 @@ forge "http://forge.puppetlabs.com"
|
||||
|
||||
mod 'puppetlabs/stdlib',
|
||||
:git => 'git://github.com/puppetlabs/puppetlabs-stdlib',
|
||||
:ref => 'origin/4.x'
|
||||
:ref => 'origin/4.x'
|
||||
|
||||
mod 'puppetlabs/apt',
|
||||
:git => 'git://github.com/puppetlabs/puppetlabs-apt',
|
||||
:ref => '1.4.0'
|
46
manifests/repo.pp
Normal file
46
manifests/repo.pp
Normal file
@ -0,0 +1,46 @@
|
||||
# Copyright (C) iWeb Technologies Inc.
|
||||
#
|
||||
# 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: François Charlier <francois.charlier@enovance.com>
|
||||
# Author: David Moreau Simard <dmsimard@iweb.com>
|
||||
|
||||
#
|
||||
# Configures Ceph's official repository for Ubuntu LTS
|
||||
#
|
||||
class ceph::repo (
|
||||
$release = 'cuttlefish'
|
||||
) {
|
||||
case $::osfamily {
|
||||
'Debian': {
|
||||
include apt::update
|
||||
|
||||
apt::key { 'ceph':
|
||||
key => '17ED316D',
|
||||
key_source => 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc',
|
||||
}
|
||||
|
||||
apt::source { 'ceph':
|
||||
location => "http://ceph.com/debian-${release}/",
|
||||
release => $::lsbdistcodename,
|
||||
require => Apt::Key['ceph'],
|
||||
}
|
||||
|
||||
Exec['apt_update'] -> Package<||>
|
||||
}
|
||||
|
||||
default: {
|
||||
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only supports osfamily Debian")
|
||||
}
|
||||
}
|
||||
}
|
102
spec/classes/ceph_repo_spec.rb
Normal file
102
spec/classes/ceph_repo_spec.rb
Normal file
@ -0,0 +1,102 @@
|
||||
# Copyright (C) iWeb Technologies Inc.
|
||||
#
|
||||
# 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: François Charlier <francois.charlier@enovance.com>
|
||||
# Author: David Moreau Simard <dmsimard@iweb.com>
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ceph::repo' do
|
||||
|
||||
describe 'Debian' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:lsbdistcodename => 'wheezy'
|
||||
}
|
||||
end
|
||||
|
||||
describe "with default params" do
|
||||
|
||||
it { should contain_apt__key('ceph').with(
|
||||
:key => '17ED316D',
|
||||
:key_source => 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc'
|
||||
) }
|
||||
|
||||
it { should contain_apt__source('ceph').with(
|
||||
:location => 'http://ceph.com/debian-cuttlefish/',
|
||||
:release => 'wheezy',
|
||||
:require => 'Apt::Key[ceph]'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
describe "when overriding ceph release" do
|
||||
let :params do
|
||||
{
|
||||
:release => 'dumpling'
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_apt__source('ceph').with(
|
||||
:location => 'http://ceph.com/debian-dumpling/',
|
||||
:release => 'wheezy',
|
||||
:require => 'Apt::Key[ceph]'
|
||||
) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'Ubuntu' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:osfamily => 'Debian',
|
||||
:lsbdistcodename => 'precise'
|
||||
}
|
||||
end
|
||||
|
||||
describe "with default params" do
|
||||
|
||||
it { should contain_apt__key('ceph').with(
|
||||
:key => '17ED316D',
|
||||
:key_source => 'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc'
|
||||
) }
|
||||
|
||||
it { should contain_apt__source('ceph').with(
|
||||
:location => 'http://ceph.com/debian-cuttlefish/',
|
||||
:release => 'precise',
|
||||
:require => 'Apt::Key[ceph]'
|
||||
) }
|
||||
|
||||
end
|
||||
|
||||
describe "when overriding ceph release" do
|
||||
let :params do
|
||||
{
|
||||
:release => 'dumpling'
|
||||
}
|
||||
end
|
||||
|
||||
it { should contain_apt__source('ceph').with(
|
||||
:location => 'http://ceph.com/debian-dumpling/',
|
||||
:release => 'precise',
|
||||
:require => 'Apt::Key[ceph]'
|
||||
) }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user