Merge pull request #61 from derekhiggins/jtopjian-puppetlabs-rebase

Jtopjian puppetlabs rebase
This commit is contained in:
Dan Bode
2012-11-15 12:59:44 -08:00
16 changed files with 127 additions and 52 deletions

View File

@@ -33,6 +33,11 @@ class swift(
ensure => $package_ensure, ensure => $package_ensure,
} }
package { 'swiftclient':
name => $::swift::params::client_package,
ensure => $package_ensure,
}
File { owner => 'swift', group => 'swift', require => Package['swift'] } File { owner => 'swift', group => 'swift', require => Package['swift'] }
file { '/home/swift': file { '/home/swift':

View File

@@ -2,14 +2,19 @@ class swift::keystone::auth(
$auth_name = 'swift', $auth_name = 'swift',
$password = 'swift_password', $password = 'swift_password',
$address = '127.0.0.1', $address = '127.0.0.1',
$port = '8080' $port = '8080',
$tenant = 'services',
$email = 'swift@localhost',
$region = 'RegionOne'
) { ) {
keystone_user { $auth_name: keystone_user { $auth_name:
ensure => present, ensure => present,
password => $password, password => $password,
email => $email,
tenant => $tenant,
} }
keystone_user_role { "${auth_name}@services": keystone_user_role { "${auth_name}@${tenant}":
ensure => present, ensure => present,
roles => 'admin', roles => 'admin',
require => Keystone_user[$auth_name] require => Keystone_user[$auth_name]
@@ -20,9 +25,8 @@ class swift::keystone::auth(
type => 'object-store', type => 'object-store',
description => 'Openstack Object-Store Service', description => 'Openstack Object-Store Service',
} }
keystone_endpoint { $auth_name: keystone_endpoint { "${region}/${auth_name}":
ensure => present, ensure => present,
region => 'RegionOne',
public_url => "http://${address}:${port}/v1/AUTH_%(tenant_id)s", public_url => "http://${address}:${port}/v1/AUTH_%(tenant_id)s",
admin_url => "http://${address}:${port}/", admin_url => "http://${address}:${port}/",
internal_url => "http://${address}:${port}/v1/AUTH_%(tenant_id)s", internal_url => "http://${address}:${port}/v1/AUTH_%(tenant_id)s",
@@ -33,9 +37,8 @@ class swift::keystone::auth(
type => 's3', type => 's3',
description => 'Openstack S3 Service', description => 'Openstack S3 Service',
} }
keystone_endpoint { "${auth_name}_s3": keystone_endpoint { "${region}/${auth_name}_s3":
ensure => present, ensure => present,
region => 'RegionOne',
public_url => "http://${address}:${port}", public_url => "http://${address}:${port}",
admin_url => "http://${address}:${port}", admin_url => "http://${address}:${port}",
internal_url => "http://${address}:${port}", internal_url => "http://${address}:${port}",

View File

@@ -2,6 +2,7 @@ class swift::params {
case $osfamily { case $osfamily {
'Debian': { 'Debian': {
$package_name = 'swift' $package_name = 'swift'
$client_package = 'python-swiftclient'
$proxy_package_name = 'swift-proxy' $proxy_package_name = 'swift-proxy'
$proxy_service_name = 'swift-proxy' $proxy_service_name = 'swift-proxy'
$object_package_name = 'swift-object' $object_package_name = 'swift-object'
@@ -13,6 +14,7 @@ class swift::params {
$account_package_name = 'swift-account' $account_package_name = 'swift-account'
$account_service_name = 'swift-account' $account_service_name = 'swift-account'
$account_replicator_service_name = 'swift-account-replicator' $account_replicator_service_name = 'swift-account-replicator'
$swift3 = 'swift-plugin-s3'
if $::operatingsystem == 'Debian' { if $::operatingsystem == 'Debian' {
$service_proivider = 'debian' $service_proivider = 'debian'
} else { } else {
@@ -21,6 +23,7 @@ class swift::params {
} }
'RedHat': { 'RedHat': {
$package_name = 'openstack-swift' $package_name = 'openstack-swift'
$client_package = 'python-swiftclient'
$proxy_package_name = 'openstack-swift-proxy' $proxy_package_name = 'openstack-swift-proxy'
$proxy_service_name = 'openstack-swift-proxy' $proxy_service_name = 'openstack-swift-proxy'
$object_package_name = 'openstack-swift-object' $object_package_name = 'openstack-swift-object'

View File

@@ -45,6 +45,7 @@ class swift::proxy(
$workers = $::processorcount, $workers = $::processorcount,
$allow_account_management = true, $allow_account_management = true,
$account_autocreate = true, $account_autocreate = true,
$log_level = 'INFO',
$package_ensure = 'present' $package_ensure = 'present'
) { ) {

View File

@@ -32,25 +32,23 @@
# #
class swift::proxy::authtoken( class swift::proxy::authtoken(
$admin_token = undef, $admin_user = 'swift',
$admin_user = undef, $admin_tenant_name = 'services',
$admin_tenant_name = undef, $admin_password = 'password',
$admin_password = undef, $auth_host = '127.0.0.1',
$delay_auth_decision = undef, $auth_port = '35357',
$auth_host = undef, $auth_protocol = 'http',
$auth_port = undef, $delay_auth_decision = 1,
$auth_protocol = undef $admin_token = false
) { ) {
keystone::client::authtoken { '/etc/swift/proxy-server.conf': $auth_uri = "${auth_protocol}://${auth_host}:5000"
admin_token => $admin_token, $fragment_title = regsubst($name, '/', '_', 'G')
admin_user => $admin_user,
admin_tenant_name => $admin_tenant_name, concat::fragment { "swift_authtoken":
admin_password => $admin_password, target => '/etc/swift/proxy-server.conf',
delay_auth_decision => $delay_auth_decision, content => template('swift/proxy/authtoken.conf.erb'),
auth_host => $auth_host, order => '22',
auth_port => $auth_port,
auth_protocol => $auth_protocol
} }
} }

View File

@@ -0,0 +1,20 @@
#
# Configure swift proxy-logging.
#
# == Dependencies
#
# == Examples
#
# == Authors
#
# Joe Topjian joe@topjian.net
#
class swift::proxy::proxy-logging {
concat::fragment { 'swift_proxy-logging':
target => '/etc/swift/proxy-server.conf',
content => template('swift/proxy/proxy-logging.conf.erb'),
order => '27',
}
}

View File

@@ -23,7 +23,7 @@
# #
class swift::proxy::s3token( class swift::proxy::s3token(
auth_host = '127.0.0.1', auth_host = '127.0.0.1',
auth_port = 5000, auth_port = '35357',
auth_protocol = 'http' auth_protocol = 'http'
) { ) {

View File

@@ -8,12 +8,22 @@
# == Authors # == Authors
# #
# François Charlier fcharlier@ploup.net # François Charlier fcharlier@ploup.net
# Joe Topjian joe@topjian.net
# #
# == Copyright # == Copyright
# #
# Copyright 2012 eNovance licensing@enovance.com # Copyright 2012 eNovance licensing@enovance.com
# #
class swift::proxy::swift3() { class swift::proxy::swift3(
$ensure = 'present'
) {
include $::swift::params
package { 'swift-plugin-s3':
name => $::swift::params::swift3,
ensure => $ensure,
}
concat::fragment { 'swift_swift3': concat::fragment { 'swift_swift3':
target => '/etc/swift/proxy-server.conf', target => '/etc/swift/proxy-server.conf',

View File

@@ -21,9 +21,8 @@ describe 'swift::keystone::auth' do
:description => 'Openstack Object-Store Service' :description => 'Openstack Object-Store Service'
) } ) }
it { should contain_keystone_endpoint('swift').with( it { should contain_keystone_endpoint('RegionOne/swift').with(
:ensure => 'present', :ensure => 'present',
:region => 'RegionOne',
:public_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s", :public_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s",
:admin_url => "http://127.0.0.1:8080/", :admin_url => "http://127.0.0.1:8080/",
:internal_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s" :internal_url => "http://127.0.0.1:8080/v1/AUTH_%(tenant_id)s"
@@ -35,9 +34,8 @@ describe 'swift::keystone::auth' do
:description => 'Openstack S3 Service' :description => 'Openstack S3 Service'
) } ) }
it { should contain_keystone_endpoint('swift_s3').with( it { should contain_keystone_endpoint('RegionOne/swift_s3').with(
:ensure => 'present', :ensure => 'present',
:region => 'RegionOne',
:public_url => 'http://127.0.0.1:8080', :public_url => 'http://127.0.0.1:8080',
:admin_url => 'http://127.0.0.1:8080', :admin_url => 'http://127.0.0.1:8080',
:internal_url => 'http://127.0.0.1:8080' :internal_url => 'http://127.0.0.1:8080'
@@ -73,11 +71,11 @@ describe 'swift::keystone::auth' do
it { should contain_keystone_service('swifty') } it { should contain_keystone_service('swifty') }
it { should contain_keystone_endpoint('swifty') } it { should contain_keystone_endpoint('RegionOne/swifty') }
it { should contain_keystone_service('swifty_s3') } it { should contain_keystone_service('swifty_s3') }
it { should contain_keystone_endpoint('swifty_s3') } it { should contain_keystone_endpoint('RegionOne/swifty_s3') }
end end
@@ -90,17 +88,15 @@ describe 'swift::keystone::auth' do
} }
end end
it { should contain_keystone_endpoint('swift').with( it { should contain_keystone_endpoint('RegionOne/swift').with(
:ensure => 'present', :ensure => 'present',
:region => 'RegionOne',
:public_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s", :public_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s",
:admin_url => "http://192.168.0.1:8081/", :admin_url => "http://192.168.0.1:8081/",
:internal_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s" :internal_url => "http://192.168.0.1:8081/v1/AUTH_%(tenant_id)s"
) } ) }
it { should contain_keystone_endpoint('swift_s3').with( it { should contain_keystone_endpoint('RegionOne/swift_s3').with(
:ensure => 'present', :ensure => 'present',
:region => 'RegionOne',
:public_url => 'http://192.168.0.1:8081', :public_url => 'http://192.168.0.1:8081',
:admin_url => 'http://192.168.0.1:8081', :admin_url => 'http://192.168.0.1:8081',
:internal_url => 'http://192.168.0.1:8081' :internal_url => 'http://192.168.0.1:8081'

View File

@@ -15,21 +15,39 @@ describe 'swift::proxy::authtoken' do
' '
end end
let :params do let :fragment_file do
{ "/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/22_swift_authtoken"
:admin_token => 'admin_token', end
:admin_user => 'admin_user',
:admin_tenant_name => 'admin_tenant_name', describe "when using default parameters" do
:admin_password => 'admin_password', it 'should build the fragment with correct parameters' do
:delay_auth_decision => 42, verify_contents(subject, fragment_file,
:auth_host => '1.2.3.4', [
:auth_port => 4682, '[filter:authtoken]',
:auth_protocol => 'https' 'paste.filter_factory = keystone.middleware.auth_token:filter_factory',
} 'signing_dir = /etc/swift',
'auth_host = 127.0.0.1',
'auth_port = 35357',
'auth_protocol = http',
'auth_uri = http://127.0.0.1:5000',
'admin_tenant_name = services',
'admin_user = swift',
'admin_password = password',
'delay_auth_decision = 1',
]
)
end
end
describe "when override parameters" do
let :params do
{
:admin_token => 'ADMINTOKEN'
}
end
it { should contain_file(fragment_file).with_content(/admin_token = ADMINTOKEN/) }
end end
it { should contain_keystone__client__authtoken('/etc/swift/proxy-server.conf').with(
params
)}
end end

View File

@@ -25,7 +25,7 @@ describe 'swift::proxy::s3token' do
[ [
'[filter:s3token]', '[filter:s3token]',
'paste.filter_factory = keystone.middleware.s3_token:filter_factory', 'paste.filter_factory = keystone.middleware.s3_token:filter_factory',
'auth_port = 5000', 'auth_port = 35357',
'auth_protocol = http', 'auth_protocol = http',
'auth_host = 127.0.0.1' 'auth_host = 127.0.0.1'
] ]

View File

@@ -18,6 +18,6 @@ describe 'swift::proxy::swift3' do
end end
it { should contain_file(fragment_file).with_content(/[filter:swift3]/) } it { should contain_file(fragment_file).with_content(/[filter:swift3]/) }
it { should contain_file(fragment_file).with_content(/use = egg:swift#swift3/) } it { should contain_file(fragment_file).with_content(/use = egg:swift3#swift3/) }
end end

View File

@@ -7,6 +7,7 @@ bind_ip = <%= proxy_local_net_ip %>
<% end %> <% end %>
workers = <%= workers %> workers = <%= workers %>
user = swift user = swift
set log_level = <%= log_level %>
[pipeline:main] [pipeline:main]
pipeline = <%= pipeline.to_a.join(' ') %> pipeline = <%= pipeline.to_a.join(' ') %>

View File

@@ -0,0 +1,17 @@
[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
signing_dir = /etc/swift
auth_host = <%= auth_host %>
auth_port = <%= auth_port %>
auth_protocol = <%= auth_protocol %>
auth_uri = <%= auth_uri %>
# if its defined
<% if admin_token -%>
admin_token = <%= admin_token %>
<% else -%>
admin_tenant_name = <%= admin_tenant_name %>
admin_user = <%= admin_user %>
admin_password = <%= admin_password %>
<% end -%>
delay_auth_decision = <%= delay_auth_decision %>

View File

@@ -0,0 +1,3 @@
[filter:proxy-logging]
use = egg:swift#proxy_logging

View File

@@ -1,3 +1,3 @@
[filter:swift3] [filter:swift3]
use = egg:swift#swift3 use = egg:swift3#swift3