From 7cf66df9e1c3b791b07a63fd6196d24bdc6dab42 Mon Sep 17 00:00:00 2001 From: ZhongShengping Date: Sun, 20 Nov 2016 23:52:10 +0800 Subject: [PATCH] Add support for Debian system We can add suport for Debian system due to have the zaqar package in Debian system. The Debian system does not support the use of services to run a second instance, because there is no zaqar-server@.service in zaqar package, so do not test it. I will Re-test it after the zaqar package solve the problem. Change-Id: I026b7d8f2b5994114d5a319200ed7c7d099b4fb5 --- manifests/params.pp | 8 ++-- spec/acceptance/zaqar_mongo_spec.rb | 55 ++++++++++++---------- spec/classes/zaqar_init_spec.rb | 2 +- spec/classes/zaqar_server_spec.rb | 2 +- spec/defines/zaqar_server_instance_spec.rb | 2 +- 5 files changed, 37 insertions(+), 32 deletions(-) diff --git a/manifests/params.pp b/manifests/params.pp index 5c021a2..b9d867c 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,15 +4,17 @@ # class zaqar::params { include ::openstacklib::defaults - $client_package = 'python-zaqarclient' + + $client_package = 'python-zaqarclient' + case $::osfamily { 'RedHat': { $package_name = 'openstack-zaqar' $service_name = 'openstack-zaqar' } 'Debian': { - $package_name = 'zaqar' - $service_name = 'zaqar' + $package_name = 'zaqar-server' + $service_name = 'zaqar-server' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem: \ diff --git a/spec/acceptance/zaqar_mongo_spec.rb b/spec/acceptance/zaqar_mongo_spec.rb index a5abd53..438da8d 100644 --- a/spec/acceptance/zaqar_mongo_spec.rb +++ b/spec/acceptance/zaqar_mongo_spec.rb @@ -24,32 +24,37 @@ describe 'basic zaqar' do class { '::mongodb::server': replset => 'zaqar', replset_members => ['127.0.0.1:27017'], + dbpath_fix => false, } $zaqar_mongodb_conn_string = 'mongodb://127.0.0.1:27017' - case $::osfamily { - 'Debian': { - warning('Zaqar is not yet packaged on Ubuntu systems.') + Mongodb_replset['zaqar'] -> Package['zaqar-common'] + + # TODO(zhongshengping): temporarily added this package + if $::osfamily == 'Debian' { + package { 'python-pymongo': + ensure => present, } - 'RedHat': { - Mongodb_replset['zaqar'] -> Package['zaqar-common'] - class {'::zaqar::management::mongodb': - uri => $zaqar_mongodb_conn_string - } - class {'::zaqar::messaging::mongodb': - uri => $zaqar_mongodb_conn_string - } - class {'::zaqar::keystone::authtoken': - password => 'a_big_secret', - } - class {'::zaqar': - unreliable => true, - } - include ::zaqar::server - # run a second instance using websockets - zaqar::server_instance{ '1': - transport => 'websocket' - } + } + + class {'::zaqar::management::mongodb': + uri => $zaqar_mongodb_conn_string + } + class {'::zaqar::messaging::mongodb': + uri => $zaqar_mongodb_conn_string + } + 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 @@ -60,10 +65,8 @@ describe 'basic zaqar' do apply_manifest(pp, :catch_changes => true) end - if os[:family].casecmp('RedHat') == 0 - describe port(8888) do - it { is_expected.to be_listening.with('tcp') } - end + describe port(8888) do + it { is_expected.to be_listening.with('tcp') } end end diff --git a/spec/classes/zaqar_init_spec.rb b/spec/classes/zaqar_init_spec.rb index b5f8edc..746e35f 100644 --- a/spec/classes/zaqar_init_spec.rb +++ b/spec/classes/zaqar_init_spec.rb @@ -75,7 +75,7 @@ describe 'zaqar' do let(:platform_params) do case facts[:osfamily] when 'Debian' - { :zaqar_common_package => 'zaqar' } + { :zaqar_common_package => 'zaqar-server' } when 'RedHat' { :zaqar_common_package => 'openstack-zaqar' } end diff --git a/spec/classes/zaqar_server_spec.rb b/spec/classes/zaqar_server_spec.rb index 24d1042..aeda330 100644 --- a/spec/classes/zaqar_server_spec.rb +++ b/spec/classes/zaqar_server_spec.rb @@ -29,7 +29,7 @@ describe 'zaqar::server' do let(:platform_params) do case facts[:osfamily] when 'Debian' - { :zaqar_service_name => 'zaqar' } + { :zaqar_service_name => 'zaqar-server' } when 'RedHat' { :zaqar_service_name => 'openstack-zaqar' } end diff --git a/spec/defines/zaqar_server_instance_spec.rb b/spec/defines/zaqar_server_instance_spec.rb index f98fc45..8d77812 100644 --- a/spec/defines/zaqar_server_instance_spec.rb +++ b/spec/defines/zaqar_server_instance_spec.rb @@ -39,7 +39,7 @@ describe 'zaqar::server_instance' do let(:platform_params) do case facts[:osfamily] when 'Debian' - { :zaqar_service_name => 'zaqar' } + { :zaqar_service_name => 'zaqar-server' } when 'RedHat' { :zaqar_service_name => 'openstack-zaqar' } end