make openstackclient package name configurable
Change-Id: Ie7d770af6d1238c3f68b7c743e8fa5255a9a5995
This commit is contained in:
		@@ -8,16 +8,16 @@
 | 
			
		||||
#    (Optional) Ensure state of the openstackclient package.
 | 
			
		||||
#    Defaults to 'present'
 | 
			
		||||
#
 | 
			
		||||
#  [*package_name*]
 | 
			
		||||
#    (Optional) The name of the package to install
 | 
			
		||||
#    Defaults to $::openstacklib::params::openstackclient_package_name
 | 
			
		||||
#
 | 
			
		||||
class openstacklib::openstackclient(
 | 
			
		||||
  $package_name   = $::openstacklib::params::openstackclient_package_name,
 | 
			
		||||
  $package_ensure = 'present',
 | 
			
		||||
){
 | 
			
		||||
) inherits ::openstacklib::params {
 | 
			
		||||
 | 
			
		||||
  $openstackclient_package_name = $::os_package_type ? {
 | 
			
		||||
    'debian' => 'python3-openstackclient',
 | 
			
		||||
    default  => 'python-openstackclient',
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ensure_packages($openstackclient_package_name, {
 | 
			
		||||
  ensure_packages($package_name, {
 | 
			
		||||
    'ensure' => $package_ensure,
 | 
			
		||||
    'tag'    => 'openstack'
 | 
			
		||||
  })
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								manifests/params.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								manifests/params.pp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
# == Class: openstacklib::params
 | 
			
		||||
#
 | 
			
		||||
# These parameters need to be accessed from several locations and
 | 
			
		||||
# should be considered to be constant
 | 
			
		||||
#
 | 
			
		||||
class openstacklib::params {
 | 
			
		||||
 | 
			
		||||
  $openstackclient_package_name = $::os_package_type ? {
 | 
			
		||||
    'debian' => 'python3-openstackclient',
 | 
			
		||||
    default  => 'python-openstackclient',
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
@@ -11,6 +11,19 @@ describe 'openstacklib::openstackclient' do
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    context 'with non default package name' do
 | 
			
		||||
      let :params do
 | 
			
		||||
        { :package_name => 'my-openstackclient' }
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it 'installs my-openstackclient' do
 | 
			
		||||
        is_expected.to contain_package('my-openstackclient').with(
 | 
			
		||||
          :ensure => 'present',
 | 
			
		||||
          :tag    => 'openstack'
 | 
			
		||||
        )
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  on_supported_os({
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user