Introduce cloudkitty::ui
This patch aims to add a new class to manage cloudkitty ui component. Change-Id: Ib91216ce33c9a3e19487f19dc2e59793a6ae7e68
This commit is contained in:
		
							
								
								
									
										24
									
								
								manifests/ui.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								manifests/ui.pp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,24 @@ | |||||||
|  | # == Class: cloudkitty::ui | ||||||
|  | # | ||||||
|  | # Installs & configure the cloudkitty ui component | ||||||
|  | # | ||||||
|  | # === Parameters | ||||||
|  | # | ||||||
|  | # [*package_ensure*] | ||||||
|  | #   (Optional) Ensure state for package. | ||||||
|  | #   Defaults to 'present'. | ||||||
|  | # | ||||||
|  | class cloudkitty::ui ( | ||||||
|  |   $package_ensure = 'present', | ||||||
|  | ) { | ||||||
|  |  | ||||||
|  |   include ::cloudkitty::deps | ||||||
|  |   include ::cloudkitty::params | ||||||
|  |  | ||||||
|  |   package { 'cloudkitty-ui': | ||||||
|  |     ensure => $package_ensure, | ||||||
|  |     name   => $::cloudkitty::params::ui_package_name, | ||||||
|  |     tag    => ['openstack', 'cloudkitty-package'], | ||||||
|  |   } | ||||||
|  |  | ||||||
|  | } | ||||||
							
								
								
									
										45
									
								
								spec/classes/cloudkitty_ui_spec.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								spec/classes/cloudkitty_ui_spec.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | |||||||
|  | require 'spec_helper' | ||||||
|  |  | ||||||
|  | describe 'cloudkitty::ui' do | ||||||
|  |  | ||||||
|  |   let :params do | ||||||
|  |     { :package_ensure => 'present' } | ||||||
|  |   end | ||||||
|  |  | ||||||
|  |   shared_examples_for 'cloudkitty-ui' do | ||||||
|  |  | ||||||
|  |     context 'when enabled' do | ||||||
|  |       it { is_expected.to contain_class('cloudkitty::params') } | ||||||
|  |       it { is_expected.to contain_class('cloudkitty::deps') } | ||||||
|  |  | ||||||
|  |       it 'installs cloudkitty-ui package' do | ||||||
|  |         is_expected.to contain_package('cloudkitty-ui').with( | ||||||
|  |           :name   => platform_params[:ui_package_name], | ||||||
|  |           :ensure => 'present', | ||||||
|  |           :tag    => ['openstack', 'cloudkitty-package'] | ||||||
|  |         ) | ||||||
|  |       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 | ||||||
|  |  | ||||||
|  |       let(:platform_params) do | ||||||
|  |         case facts[:osfamily] | ||||||
|  |         when 'Debian' | ||||||
|  |           { :ui_package_name => 'cloudkitty-dashboard' } | ||||||
|  |         when 'RedHat' | ||||||
|  |           { :ui_package_name => 'openstack-cloudkitty-ui' } | ||||||
|  |         end | ||||||
|  |       end | ||||||
|  |       it_configures 'cloudkitty-ui' | ||||||
|  |     end | ||||||
|  |   end | ||||||
|  |  | ||||||
|  | end | ||||||
		Reference in New Issue
	
	Block a user
	 Xingchao Yu
					Xingchao Yu