Split apt_components for bare metal provisioning

The openstack-ppa.list file gets generated with an extra 'trusty'
resulting in a failed convergence on bare metal nodes.

Change-Id: I22235c3eed6a9abd0371d86ea80b71e4702e9ea4
This commit is contained in:
Samuel Cassiba 2016-04-18 08:31:50 -07:00
parent 577d0e022f
commit 9bf2da101c
3 changed files with 6 additions and 8 deletions

View File

@ -126,7 +126,7 @@ default['openstack']['release'] = 'mitaka'
default['openstack']['apt']['update_apt_cache'] = false default['openstack']['apt']['update_apt_cache'] = false
default['openstack']['apt']['live_updates_enabled'] = true default['openstack']['apt']['live_updates_enabled'] = true
default['openstack']['apt']['uri'] = 'http://ubuntu-cloud.archive.canonical.com/ubuntu' default['openstack']['apt']['uri'] = 'http://ubuntu-cloud.archive.canonical.com/ubuntu'
default['openstack']['apt']['components'] = ["#{node['lsb']['codename']}-updates/#{node['openstack']['release']}", 'main'] default['openstack']['apt']['components'] = ['main']
# For the SRU packaging, use this: # For the SRU packaging, use this:
# default['openstack']['apt']['components'] = [ '%codename%-proposed/%release%', 'main' ] # default['openstack']['apt']['components'] = [ '%codename%-proposed/%release%', 'main' ]

View File

@ -32,13 +32,9 @@ when 'debian'
if node['openstack']['apt']['live_updates_enabled'] if node['openstack']['apt']['live_updates_enabled']
apt_components = node['openstack']['apt']['components'] apt_components = node['openstack']['apt']['components']
# Simple variable substitution for LSB codename and OpenStack release
apt_components.each do |comp|
comp.gsub! '%release%', node['openstack']['release']
comp.gsub! '%codename%', node['lsb']['codename']
end
apt_repository 'openstack-ppa' do apt_repository 'openstack-ppa' do
uri node['openstack']['apt']['uri'] uri node['openstack']['apt']['uri']
distribution "#{node['lsb']['codename']}-updates/#{node['openstack']['release']}"
components apt_components components apt_components
end end
end end

View File

@ -29,14 +29,16 @@ describe 'openstack-common::default' do
node.set['openstack']['apt']['live_updates_enabled'] = true node.set['openstack']['apt']['live_updates_enabled'] = true
expect(chef_run).to add_apt_repository('openstack-ppa').with( expect(chef_run).to add_apt_repository('openstack-ppa').with(
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu', uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
components: ['trusty-updates/mitaka', 'main']) distribution: 'trusty-updates/mitaka',
components: ['main'])
end end
it 'disables openstack live updates' do it 'disables openstack live updates' do
node.set['openstack']['apt']['live_updates_enabled'] = false node.set['openstack']['apt']['live_updates_enabled'] = false
expect(chef_run).to_not add_apt_repository('openstack-ppa').with( expect(chef_run).to_not add_apt_repository('openstack-ppa').with(
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu', uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
components: ['trusty-updates/mitaka', 'main']) distribution: 'trusty-updates/mitaka',
components: ['main'])
end end
it 'does not install the gem chef-vault by default' do it 'does not install the gem chef-vault by default' do