Merge pull request #13 from bodepd/e1f44ff26f6b6bd00f7b33e65c2e5cc0fbbba0d0

Swift refactor for fedora support
This commit is contained in:
Dan Bode 2012-03-22 22:47:36 -07:00
commit ff6ec8b8dc
20 changed files with 127 additions and 26 deletions

25
TODO

@ -32,3 +32,28 @@ autocreate - should be set to true if tempauth is used
verify uniqueness constaint of url/port across types
- if it exists, they should be the same type
set up swauth auth adress??
-
[filter:keystone]
use = egg:keystone#swiftauth
auth_protocol = https
auth_host = 127.0.0.0
auth_port = 35357
admin_token = 999888777666
delay_auth_decision = 0
service_protocol = https
service_host = 127.0.0.0
service_port = 5000
service_pass = dTpw
cache = swift.cache
[filter:healthcheck]
- crowbar copies hash and ringfiles
### important
- set up an rsync server
- and sync rings via rsync

@ -115,4 +115,3 @@ if File.exists?(expected_file)
else
raise(Exception, "file #{expected_file} did not exist somehow, probably b/c swift is not installed correctly")
end

@ -24,9 +24,12 @@ class swift(
$package_ensure = 'present'
) {
include swift::params
Class['ssh::server::install'] -> Class['swift']
package { 'swift':
name => $::swift::params::package_name,
ensure => $package_ensure,
}

31
manifests/params.pp Normal file

@ -0,0 +1,31 @@
class swift::params {
case $osfamily {
'Debian': {
$package_name = 'swift'
$proxy_package_name = 'swift-proxy'
$proxy_service_name = 'swift-proxy'
$object_package_name = 'swift-object'
$object_service_name = 'swift-object'
$container_package_name = 'swift-container'
$container_service_name = 'swift-container'
$account_package_name = 'swift-account'
$account_service_name = 'swift-account'
$service_provider = 'upstart'
}
'RedHat': {
$package_name = 'openstack-swift'
$proxy_package_name = 'openstack-swift-proxy'
$proxy_service_name = 'openstack-swift-proxy'
$object_package_name = 'openstack-swift-object'
$object_service_name = 'openstack-swift-object'
$container_package_name = 'openstack-swift-container'
$container_service_name = 'openstack-swift-container'
$account_package_name = 'openstack-swift-account'
$account_service_name = 'openstack-swift-account'
$service_provider = undef
}
default: {
fail("Unsupported osfamily: ${osfamily} for os ${operatingsystem}")
}
}
}

@ -76,6 +76,7 @@ class swift::proxy(
}
package { 'swift-proxy':
name => $::swift::params::proxy_package_name,
ensure => $package_ensure,
}
@ -127,8 +128,9 @@ post-stop exec /usr/bin/swift-init proxy-server stop',
}
service { 'swift-proxy':
name => $::swift::params::proxy_service_name,
ensure => running,
provider => 'upstart',
provider => $::swift::params::service_provider,
enable => true,
subscribe => File['/etc/swift/proxy-server.conf'],
}

@ -27,9 +27,4 @@ class swift::storage(
use_xinetd => true,
address => $storage_local_net_ip,
}
# package dependencies
package { ['xfsprogs', 'parted']:
ensure => 'present'
}
}

@ -19,14 +19,17 @@
# Copyright 2011 Puppetlabs Inc, unless otherwise noted.
define swift::storage::generic(
$package_ensure = 'present',
$service_provider = 'upstart'
$service_provider = $::swift::params::service_provider
) {
include swift::params
Class['swift::storage'] -> Swift::Storage::Generic[$name]
validate_re($name, '^object|container|account$')
package { "swift-${name}":
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_package_name') %>"),
ensure => $package_ensure,
}
@ -37,6 +40,7 @@ define swift::storage::generic(
}
service { "swift-${name}":
name => inline_template("<%= scope.lookupvar('::swift::params::${name}_service_name') %>"),
ensure => running,
enable => true,
hasstatus => true,

@ -16,6 +16,7 @@ define swift::storage::xfs(
$mnt_base_dir = '/srv/node'
) {
include swift::xfs
# does this have to be refreshonly?
# how can I know if this drive has been formatted?
exec { "mkfs-${name}":

8
manifests/xfs.pp Normal file

@ -0,0 +1,8 @@
#
# package dependencies for creating
# xfs partitions
class swift::xfs {
package { ['xfsprogs', 'parted']:
ensure => 'present'
}
}

@ -13,6 +13,7 @@ describe 'swift::proxy' do
# set os so memcache will not fail
let :facts do
{:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:processorcount => 1
}
end

@ -2,8 +2,10 @@ require 'spec_helper'
describe 'swift::ringbuilder' do
let :facts do
{:operatingsystem => 'Ubuntu',
:processorcount => 1
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:processorcount => 1
}
end
describe 'when swift class is not included' do

@ -7,7 +7,10 @@ describe 'swift' do
end
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do

@ -2,7 +2,10 @@ require 'spec_helper'
describe 'swift::storage::account' do
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do

@ -4,7 +4,10 @@ describe 'swift::storage::all' do
# TODO I am not testing the upstart code b/c it should be temporary
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do
@ -49,10 +52,6 @@ describe 'swift::storage::all' do
param_set
end
['xfsprogs', 'parted'].each do |present_package|
it { should contain_package(present_package).with_ensure('present') }
end
['object', 'container', 'account'].each do |type|
it { should contain_package("swift-#{type}").with_ensure('present') }
it { should contain_service("swift-#{type}").with(

@ -2,7 +2,10 @@ require 'spec_helper'
describe 'swift::storage::container' do
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do

@ -2,7 +2,10 @@ require 'spec_helper'
describe 'swift::storage::object' do
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do

@ -4,7 +4,10 @@ describe 'swift::storage' do
# TODO I am not testing the upstart code b/c it should be temporary
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
describe 'when required classes are specified' do
@ -21,10 +24,6 @@ describe 'swift::storage' do
}
end
['xfsprogs', 'parted'].each do |present_package|
it { should contain_package(present_package).with_ensure('present') }
end
it { should contain_class('rsync::server').with(
{:use_xinetd => true,
:address => params[:storage_local_net_ip]

@ -6,7 +6,10 @@ describe 'swift::storage::generic' do
end
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do

@ -2,7 +2,11 @@ require 'spec_helper'
describe 'swift::storage::server' do
let :facts do
{:operatingsystem => 'Ubuntu'}
{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian'
}
end
let :pre_condition do

@ -27,6 +27,19 @@ user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3
<% elsif auth_type == 'keystone' -%>
[filter:keystone]
use = egg:keystone#swiftauth
auth_protocol = https
auth_host = 127.0.0.0
auth_port = 35357
admin_token = 999888777666
delay_auth_decision = 0
service_protocol = https
service_host = 127.0.0.0
service_port = 5000
service_pass = dTpw
cache = swift.cache
<% end -%>
[filter:healthcheck]