From 3f16ce2c0c0f73fc863d33022033112084a9b6c5 Mon Sep 17 00:00:00 2001 From: Giulio Fidente Date: Wed, 9 Nov 2016 21:01:51 +0100 Subject: Normalize civetweb binding address if IPv6 The civetweb binding format is IP:PORT; this change ensures the IP is enclosed in brackets if IPv6. To do so we add the bind_ip and bind_port parameters to the rgw service class. Change-Id: Ib84fa3479c2598bff7e89ad60a1c7d5f2c22c18c Co-Authored-By: Lukas Bezdicka Related-Bug: #1636515 --- manifests/profile/base/ceph/rgw.pp | 20 ++++++++++++++++++-- spec/classes/tripleo_profile_base_ceph_rgw_spec.rb | 16 ++++++++++++---- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/manifests/profile/base/ceph/rgw.pp b/manifests/profile/base/ceph/rgw.pp index 7cd2b6a..2ecca52 100644 --- a/manifests/profile/base/ceph/rgw.pp +++ b/manifests/profile/base/ceph/rgw.pp @@ -18,6 +18,14 @@ # # === Parameters # +# [*civetweb_bind_ip*] +# IP address where to bind the RGW civetweb instance +# (Optional) Defaults to 127.0.0.1 +# +# [*civetweb_bind_port*] +# PORT where to bind the RGW civetweb instance +# (Optional) Defaults to 8080 +# # [*keystone_admin_token*] # The keystone admin token # @@ -36,14 +44,22 @@ class tripleo::profile::base::ceph::rgw ( $keystone_admin_token, $keystone_url, $rgw_key, - $step = hiera('step'), + $civetweb_bind_ip = '127.0.0.1', + $civetweb_bind_port = '8080', + $step = hiera('step'), ) { include ::tripleo::profile::base::ceph if $step >= 3 { - include ::ceph::profile::rgw $rgw_name = hiera('ceph::profile::params::rgw_name', 'radosgw.gateway') + $civetweb_bind_ip_real = normalize_ip_for_uri($civetweb_bind_ip) + include ::ceph::params + include ::ceph::profile::base + ceph::rgw { $rgw_name: + frontend_type => 'civetweb', + rgw_frontends => "civetweb port=${civetweb_bind_ip_real}:${civetweb_bind_port}" + } ceph::key { "client.${rgw_name}": secret => $rgw_key, cap_mon => 'allow *', diff --git a/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb b/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb index e9459d0..88f971b 100644 --- a/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb +++ b/spec/classes/tripleo_profile_base_ceph_rgw_spec.rb @@ -30,7 +30,9 @@ describe 'tripleo::profile::base::ceph::rgw' do { :keystone_admin_token => 'token', :keystone_url => 'url', - :rgw_key => 'key' + :rgw_key => 'key', + :civetweb_bind_ip => '2001:db8:0:1234:0:567:8:1', + :civetweb_bind_port => '8888', } end @@ -39,7 +41,7 @@ describe 'tripleo::profile::base::ceph::rgw' do it 'should do nothing' do is_expected.to contain_class('tripleo::profile::base::ceph::rgw') is_expected.to contain_class('tripleo::profile::base::ceph') - is_expected.to_not contain_class('ceph::profile::rgw') + is_expected.to_not contain_class('ceph::rgw') end end @@ -47,7 +49,10 @@ describe 'tripleo::profile::base::ceph::rgw' do let(:params) { default_params.merge({ :step => 3 }) } it 'should include rgw configuration' do is_expected.to contain_class('tripleo::profile::base::ceph') - is_expected.to contain_class('ceph::profile::rgw') + is_expected.to contain_ceph__rgw('radosgw.gateway').with( + :frontend_type => 'civetweb', + :rgw_frontends => 'civetweb port=[2001:db8:0:1234:0:567:8:1]:8888' + ) is_expected.to contain_ceph__key('client.radosgw.gateway').with( :secret => 'key', :cap_mon => 'allow *', @@ -62,7 +67,10 @@ describe 'tripleo::profile::base::ceph::rgw' do let(:params) { default_params.merge({ :step => 4 }) } it 'should include rgw configuration' do is_expected.to contain_class('tripleo::profile::base::ceph') - is_expected.to contain_class('ceph::profile::rgw') + is_expected.to contain_ceph__rgw('radosgw.gateway').with( + :frontend_type => 'civetweb', + :rgw_frontends => 'civetweb port=[2001:db8:0:1234:0:567:8:1]:8888' + ) is_expected.to contain_ceph__key('client.radosgw.gateway').with( :secret => 'key', :cap_mon => 'allow *', -- cgit 1.2.3-korg