Browse Source

Default file for all. Use it for virtual package.

This file is to be included by all puppet modules.

First feature is to make sure that allow_virtual is set to true for all
openstack modules.  It's set to false for puppet 3.6.1 to
4.0.0 [1]

[1] https://docs.puppet.com/puppet/3.6/reference/release_notes.html#puppet-361

Change-Id: I9d0a10d48124ee71ea80134ceef96436c8ee196e
Closes-Bug: 1599113
Related-Bug: 1597753
Depends-On: I2699eaa3a10589c9a0c680bb1de489994fe01b67
changes/00/336500/7
Sofer Athlan-Guyot 6 years ago
parent
commit
8cf821dc2f
  1. 11
      examples/virtual_packages.pp
  2. 14
      manifests/defaults.pp
  3. 12
      releasenotes/notes/feature_add_default_config_placeholder-280f69c0edbf76c6.yaml
  4. 7
      spec/acceptance/defaults_spec.rb
  5. 33
      spec/classes/openstacklib_defaults_spec.rb

11
examples/virtual_packages.pp

@ -0,0 +1,11 @@
Exec { logoutput => 'on_failure' }
include ::openstacklib::defaults
if $::osfamily == 'RedHat' {
# Virtual package name, present in @base.
package { 'perl(Net::HTTP)':
ensure => present,
tag => 'openstack',
}
}

14
manifests/defaults.pp

@ -0,0 +1,14 @@
# == Class: openstacklib::defaults
#
# Default configuration for all openstack-puppet module.
#
# This file is loaded in the params.pp of each class.
#
class openstacklib::defaults {
# Ensure all package resources have virtual package enable.
if versioncmp($::puppetversion, '4.0.0') < 0 and versioncmp($::puppetversion, '3.6.1') >= 0 {
Package<| tag == 'openstack' |> {
allow_virtual => true,
}
}
}

12
releasenotes/notes/feature_add_default_config_placeholder-280f69c0edbf76c6.yaml

@ -0,0 +1,12 @@
---
features:
- Add a manifest which is loaded by all puppet modules in
manifests/param.pp. This is described in
`bug 1599113
<https://bugs.launchpad.net/puppet-openstacklib/+bug/1599113>`__
fixes:
- The first feature would help fixing RDO package using virtual
package which is a recurring problem. Example of such problem is
`bug 1599113
<https://bugs.launchpad.net/puppet-keystone/+bug/1597753>`__

7
spec/acceptance/defaults_spec.rb

@ -0,0 +1,7 @@
require 'spec_helper_acceptance'
describe 'Defaults manifest' do
context 'virtual_package' do
it_behaves_like 'puppet_apply_success_from_example', 'virtual_packages'
end
end

33
spec/classes/openstacklib_defaults_spec.rb

@ -0,0 +1,33 @@
require 'spec_helper'
describe 'openstacklib::defaults', type: :class do
on_supported_os.each do |os, facts|
let(:pre_condition) do
<<-eof
package { 'my_virt_package' :
ensure => present,
tag => 'openstack'
}
eof
end
context "Puppet < 4.0.0" do
context "on #{os}" do
let(:facts) { facts.merge(:puppetversion => '3.8.0') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('openstacklib::defaults') }
it { is_expected.to contain_package('my_virt_package')
.with(:allow_virtual => true)}
end
end
context "Puppet >= 4.0.0" do
context "on #{os}" do
let(:facts) { facts.merge(:puppetversion => '4.0.0') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('openstacklib::defaults') }
it { is_expected.to contain_package('my_virt_package')
.without(:allow_virtual)}
end
end
end
end
Loading…
Cancel
Save