diff --git a/manifests/params.pp b/manifests/params.pp index e899c44..f7be568 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,6 +4,13 @@ # class magnum::params { include ::openstacklib::defaults + + if ($::os_package_type == 'debian') { + $pyvers = '3' + } else { + $pyvers = '' + } + $group = 'magnum' case $::osfamily { 'RedHat': { @@ -24,7 +31,7 @@ class magnum::params { # service names $api_service = 'magnum-api' $conductor_service = 'magnum-conductor' - $client_package = 'python-magnumclient' + $client_package = "python${pyvers}-magnumclient" } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem") diff --git a/spec/classes/magnum_client_spec.rb b/spec/classes/magnum_client_spec.rb index 196cfef..1dd0ea4 100644 --- a/spec/classes/magnum_client_spec.rb +++ b/spec/classes/magnum_client_spec.rb @@ -10,7 +10,7 @@ describe 'magnum::client' do it 'installs magnum client package' do is_expected.to contain_package('python-magnumclient').with( :ensure => 'present', - :name => platform_params[:client_package], + :name => platform_params[:client_package_name], :tag => 'openstack', ) end @@ -27,9 +27,13 @@ describe 'magnum::client' do let(:platform_params) do case facts[:osfamily] when 'Debian' - { :client_package => 'python-magnumclient' } + if facts[:os_package_type] == 'debian' + { :client_package_name => 'python3-magnumclient' } + else + { :client_package_name => 'python-magnumclient' } + end when 'RedHat' - { :client_package => 'python2-magnumclient' } + { :client_package_name => 'python2-magnumclient' } end end it_configures 'magnum client'