 1858c025b2
			
		
	
	1858c025b2
	
	
	
		
			
			* version bump to 13.0.0 for mitaka release * removed suse support * removed general endpoint method, since we should be able to always specify which endpoint we need * removed fallbacks in specific_endpoint method, since this behaviour is not a very obvious one to the user and it should rather return an error than an unexpected result * dry public, internal and admin endpoint methods * removed obsolete private methods * adapted method calls for admin_endpoint in libraries/cli.rb * refactored set_endpoints_by_interface recipe to directly call address_for instead of address, since the recipe already checks for an existing attribute ..['bind_interface'] and therefore address would redirect to address_for anyways * moved the nested hash order for the public, internal and admin attributes to to be more clear and to break all existing calls to fix them during the refactoring process of all cookbooks e.g: node['openstack']['endpoints']['internal']['identity'] is now node['openstack']['endpoints']['identity']['internal'] and can be moved into the identity cookbook. This also streamlines these endpoint attributes with the bind_interface and host attributes * removed dependency on openstack-identity cookbooks by moving openrc recipe to opentack-identity (same for corrensponding specs and template) * removed address method and use the address (or hostname) defined in the endpoints hash directly (logic to set this attribute should rather be done in a wrapper (with a fitting method) instead of a static and predefined one) * removed set_endpoints_by_interface recipe since logic for defining the endpoints will be moved to wrapper cookbooks * added helper method merge_config_options for generation of config hashes used in service config templates * added template for openstack-service.conf.erb which can be used by all service cookbooks * deleted all endpoints attibutes, since these are moved to the service cookbooks for easier dependency handling Implements: blueprint cookbook-refactoring Change-Id: I0547182085eed91d05384fdd7734408a839a9a2c
		
			
				
	
	
		
			57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| # encoding: UTF-8
 | |
| require_relative 'spec_helper'
 | |
| require ::File.join ::File.dirname(__FILE__), '..', 'libraries', 'config_helpers'
 | |
| 
 | |
| describe 'openstack-common::default' do
 | |
|   describe 'module Openstack config_helpers' do
 | |
|     let(:runner) { ChefSpec::SoloRunner.new(CHEFSPEC_OPTS) }
 | |
|     let(:node) { runner.node }
 | |
|     let(:chef_run) do
 | |
|       runner.converge(described_recipe)
 | |
|     end
 | |
|     let(:subject) { Object.new.extend(Openstack) }
 | |
|     include_context 'library-stubs'
 | |
|     before do
 | |
|       node.set['openstack']['anyservice']['conf'] =
 | |
|         {
 | |
|           'Default' => { 'logfile' => 'file_to_log' },
 | |
|           'secret_section' => {},
 | |
|           'another_section' => { 'foo' => 'bar', 'baz' => 'yay' },
 | |
|           'deep_section' => {
 | |
|             'foo' => { key: 'bar', value: 'baz' },
 | |
|             'baz' => 'yay'
 | |
|           }
 | |
|         }
 | |
|       node.set['openstack']['anyservice']['conf_secrets'] =
 | |
|         {
 | |
|           'Default' => { 'secret_log' => 'secret_file_to_log' },
 | |
|           'secret_section' => { 'password' => '1234' },
 | |
|           'another_section' => { 'secret_foo' => 'secret_bar' },
 | |
|           'another_secret_section' => { 'secret_baz' => 'secret_yay' }
 | |
|         }
 | |
|     end
 | |
| 
 | |
|     describe 'merge_config_options' do
 | |
|       it ' node objects should be duped and be kind of Mash afterwards' do
 | |
|         expect(
 | |
|           subject.merge_config_options('anyservice')
 | |
|         ).to be_a(Mash)
 | |
|       end
 | |
|       it 'duped node objects should be merged correctly' do
 | |
|         expect(
 | |
|           subject.merge_config_options('anyservice')
 | |
|         ).to eq(
 | |
|           'Default' => { 'logfile' => 'file_to_log', 'secret_log' => 'secret_file_to_log' },
 | |
|           'secret_section' => { 'password' => '1234' },
 | |
|           'another_section' => { 'foo' => 'bar', 'baz' => 'yay', 'secret_foo' => 'secret_bar' },
 | |
|           'another_secret_section' => { 'secret_baz' => 'secret_yay' },
 | |
|           'deep_section' => {
 | |
|             'foo' => { 'key' => 'bar', 'value' => 'baz' },
 | |
|             'baz' => 'yay'
 | |
|           }
 | |
|         )
 | |
|       end
 | |
|     end
 | |
|   end
 | |
| end
 |