Add support for the swift backend
This adds support for running swift as the messaging backend of Zaqar, and SQLAlchemy as the management backend. Change-Id: I448d303d01e33a0d89625d7ff442b652838d9c36
This commit is contained in:
parent
4ba63c137f
commit
889be10904
@ -46,6 +46,14 @@
|
||||
# Defines the maximum size of message posts. (integer value)
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*message_store*]
|
||||
# Backend driver for message storage.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*management_store*]
|
||||
# Backend driver for management storage.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*unreliable*]
|
||||
# Disable all reliability constraints. (boolean value)
|
||||
# Default false
|
||||
@ -73,6 +81,8 @@ class zaqar(
|
||||
$claim_pipeline = $::os_service_default,
|
||||
$subscription_pipeline = $::os_service_default,
|
||||
$max_messages_post_size = $::os_service_default,
|
||||
$message_store = 'mongodb',
|
||||
$management_store = 'mongodb',
|
||||
$package_name = $::zaqar::params::package_name,
|
||||
$package_ensure = 'present',
|
||||
$purge_config = false,
|
||||
@ -104,6 +114,8 @@ class zaqar(
|
||||
'storage/claim_pipeline': value => $claim_pipeline;
|
||||
'storage/subscription_pipeline': value => $subscription_pipeline;
|
||||
'transport/max_messages_post_size': value => $max_messages_post_size;
|
||||
'drivers/message_store': value => $message_store;
|
||||
'drivers/management_store': value => $management_store;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ class zaqar::management::mongodb(
|
||||
include ::zaqar::deps
|
||||
|
||||
zaqar_config {
|
||||
'drivers/management_store': value => 'mongodb';
|
||||
'drivers:management_store:mongodb/uri': value => $uri, secret => true;
|
||||
'drivers:management_store:mongodb/ssl_keyfile': value => $ssl_keyfile;
|
||||
'drivers:management_store:mongodb/ssl_certfile': value => $ssl_certfile;
|
||||
|
16
manifests/management/sqlalchemy.pp
Normal file
16
manifests/management/sqlalchemy.pp
Normal file
@ -0,0 +1,16 @@
|
||||
# == class: zaqar::management::sqlalchemy
|
||||
#
|
||||
# [*uri*]
|
||||
# SQLAlchemy Connection URI. Required.
|
||||
#
|
||||
class zaqar::management::sqlalchemy(
|
||||
$uri,
|
||||
) {
|
||||
|
||||
include ::zaqar::deps
|
||||
|
||||
zaqar_config {
|
||||
'drivers:management_store:sqlalchemy/uri': value => $uri, secret => true;
|
||||
}
|
||||
|
||||
}
|
@ -81,7 +81,6 @@ class zaqar::messaging::mongodb(
|
||||
include ::zaqar::deps
|
||||
|
||||
zaqar_config {
|
||||
'drivers/message_store': value => 'mongodb';
|
||||
'drivers:message_store:mongodb/uri': value => $uri, secret => true;
|
||||
'drivers:message_store:mongodb/ssl_keyfile': value => $ssl_keyfile;
|
||||
'drivers:message_store:mongodb/ssl_certfile': value => $ssl_certfile;
|
||||
|
21
manifests/messaging/swift.pp
Normal file
21
manifests/messaging/swift.pp
Normal file
@ -0,0 +1,21 @@
|
||||
# == class: zaqar::messaging::swift
|
||||
#
|
||||
# [*uri*]
|
||||
# Swift Connection URI. Required.
|
||||
#
|
||||
# [*auth_url*]
|
||||
# URL to the KeyStone service. Default $::os_service_default
|
||||
#
|
||||
class zaqar::messaging::swift(
|
||||
$uri,
|
||||
$auth_url = $::os_service_default,
|
||||
) {
|
||||
|
||||
include ::zaqar::deps
|
||||
|
||||
zaqar_config {
|
||||
'drivers:message_store:swift/uri': value => $uri, secret => true;
|
||||
'drivers:message_store:swift/auth_url': value => $auth_url;
|
||||
}
|
||||
|
||||
}
|
62
spec/acceptance/zaqar_swift_spec.rb
Normal file
62
spec/acceptance/zaqar_swift_spec.rb
Normal file
@ -0,0 +1,62 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'swift zaqar' do
|
||||
|
||||
context 'default parameters' do
|
||||
|
||||
it 'zaqar with swift should work with no errors' do
|
||||
pp= <<-EOS
|
||||
include ::openstack_integration
|
||||
include ::openstack_integration::repos
|
||||
include ::openstack_integration::mysql
|
||||
include ::openstack_integration::keystone
|
||||
include ::openstack_integration::swift
|
||||
|
||||
class { '::memcached':
|
||||
listen_ip => '127.0.0.1',
|
||||
}
|
||||
|
||||
class { '::zaqar::keystone::auth':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
|
||||
class { '::zaqar::keystone::auth_websocket':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
|
||||
class {'::zaqar::management::sqlalchemy':
|
||||
uri => 'mysql+pymysql://zaqar:a_big_secret@127.0.0.1/zaqar?charset=utf8',
|
||||
}
|
||||
class {'::zaqar::messaging::swift':
|
||||
uri => 'swift://zaqar:a_big_secret:/service'
|
||||
}
|
||||
class {'::zaqar::keystone::authtoken':
|
||||
password => 'a_big_secret',
|
||||
}
|
||||
class {'::zaqar':
|
||||
unreliable => true,
|
||||
}
|
||||
include ::zaqar::server
|
||||
# run a second instance using websockets, the Debian system does
|
||||
# not support the use of services to run a second instance.
|
||||
if $::osfamily == 'RedHat' {
|
||||
zaqar::server_instance{ '1':
|
||||
transport => 'websocket'
|
||||
}
|
||||
}
|
||||
EOS
|
||||
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
apply_manifest(pp, :catch_changes => true)
|
||||
end
|
||||
|
||||
describe port(8888) do
|
||||
it { is_expected.to be_listening.with('tcp') }
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -49,6 +49,8 @@ describe 'zaqar' do
|
||||
:claim_pipeline => 'zaqar_pipeline3',
|
||||
:subscription_pipeline => 'zaqar_pipeline4',
|
||||
:max_messages_post_size => '1234',
|
||||
:message_store => 'swift',
|
||||
:management_store => 'sqlalchemy',
|
||||
})
|
||||
end
|
||||
|
||||
@ -61,6 +63,8 @@ describe 'zaqar' do
|
||||
is_expected.to contain_zaqar_config('storage/claim_pipeline').with_value('zaqar_pipeline3')
|
||||
is_expected.to contain_zaqar_config('storage/subscription_pipeline').with_value('zaqar_pipeline4')
|
||||
is_expected.to contain_zaqar_config('transport/max_messages_post_size').with_value('1234')
|
||||
is_expected.to contain_zaqar_config('drivers/message_store').with_value('swift')
|
||||
is_expected.to contain_zaqar_config('drivers/management_store').with_value('sqlalchemy')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,6 +3,14 @@ require 'spec_helper'
|
||||
describe 'zaqar::management::mongodb' do
|
||||
|
||||
shared_examples_for 'zaqar::management::mongodb' do
|
||||
let :pre_condition do
|
||||
"class { '::zaqar::keystone::authtoken':
|
||||
password =>'foo',
|
||||
}
|
||||
class { '::zaqar':
|
||||
}"
|
||||
|
||||
end
|
||||
let :req_params do
|
||||
{
|
||||
:uri => 'mongodb://127.0.0.1:27017',
|
||||
|
51
spec/classes/zaqar_management_sqlalchemy_spec.rb
Normal file
51
spec/classes/zaqar_management_sqlalchemy_spec.rb
Normal file
@ -0,0 +1,51 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'zaqar::management::sqlalchemy' do
|
||||
|
||||
shared_examples_for 'zaqar::management::sqlalchemy' do
|
||||
let :pre_condition do
|
||||
"class { '::zaqar::keystone::authtoken':
|
||||
password =>'foo',
|
||||
}
|
||||
class { '::zaqar':
|
||||
management_store =>'sqlalchemy',
|
||||
}"
|
||||
|
||||
end
|
||||
let :req_params do
|
||||
{
|
||||
:uri => 'mysql://user:pass@127.0.0.1/zaqar',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'should config sqlalchemy management driver' do
|
||||
is_expected.to contain_zaqar_config('drivers/management_store').with(
|
||||
:value => 'sqlalchemy'
|
||||
)
|
||||
is_expected.to contain_zaqar_config('drivers:management_store:sqlalchemy/uri').with(
|
||||
:value => 'mysql://user:pass@127.0.0.1/zaqar',
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'zaqar::management::sqlalchemy'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -3,6 +3,14 @@ require 'spec_helper'
|
||||
describe 'zaqar::messaging::mongodb' do
|
||||
|
||||
shared_examples_for 'zaqar::messaging::mongodb' do
|
||||
let :pre_condition do
|
||||
"class { '::zaqar::keystone::authtoken':
|
||||
password =>'foo',
|
||||
}
|
||||
class { '::zaqar':
|
||||
}"
|
||||
|
||||
end
|
||||
let :req_params do
|
||||
{
|
||||
:uri => 'mongodb://127.0.0.1:27017',
|
||||
|
61
spec/classes/zaqar_messaging_swift_spec.rb
Normal file
61
spec/classes/zaqar_messaging_swift_spec.rb
Normal file
@ -0,0 +1,61 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'zaqar::messaging::swift' do
|
||||
|
||||
shared_examples_for 'zaqar::messaging::swift' do
|
||||
let :pre_condition do
|
||||
"class { '::zaqar::keystone::authtoken':
|
||||
password =>'foo',
|
||||
}
|
||||
class { '::zaqar':
|
||||
message_store =>'swift',
|
||||
}"
|
||||
end
|
||||
let :req_params do
|
||||
{
|
||||
:uri => 'swift://user:pass@/zaqar',
|
||||
}
|
||||
end
|
||||
|
||||
describe 'with only required params' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'should config swift messaging driver' do
|
||||
is_expected.to contain_zaqar_config('drivers/message_store').with(
|
||||
:value => 'swift'
|
||||
)
|
||||
is_expected.to contain_zaqar_config('drivers:message_store:swift/uri').with(
|
||||
:value => 'swift://user:pass@/zaqar',
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
describe 'with custom values' do
|
||||
let :params do
|
||||
req_params.merge!({
|
||||
:auth_url => 'http://foo',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures custom values' do
|
||||
is_expected.to contain_zaqar_config('drivers:message_store:swift/auth_url').with_value('http://foo')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'zaqar::messaging::swift'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user