Ensure apt runs before packages are updated.

Previously on 12.04 this would attempt to update ubuntu-cloud-keyring
and instantly fail when ran against vagrant images that hadn't done an
apt-get update recently.

Change-Id: I65f88668d7438f60aa741f4df032bd3040fa6a2b
Closes-Bug: #1375443
This commit is contained in:
Ashley Penney
2014-09-29 15:49:37 -04:00
committed by JJ Asghar
parent 28281c4ca2
commit 2a95cc4080
4 changed files with 18 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ This file is used to list changes made in each version of cookbook-openstack-com
* Make default using cinder v2 api
* Add OS_VOLUME_API_VERSION for openrc
* Removed the hardcoded PPA reference to "Precise"
* Added an optional automatic apt-get update for Debian based repos
## 10.1.0
* Adding identity admin bind host endpoint to allow flexibility and consistency

View File

@@ -108,6 +108,10 @@ default['openstack']['release'] = 'juno'
# In the component strings, %codename% will be replaced by the value of
# the node['lsb']['codename'] Ohai value and %release% will be replaced
# by the value of node['openstack']['release']
#
# Change ['openstack']['apt']['update_apt_cache'] to true if you would like
# have the cache automaticly updated
default['openstack']['apt']['update_apt_cache'] = false
default['openstack']['apt']['live_updates_enabled'] = true
default['openstack']['apt']['uri'] = 'http://ubuntu-cloud.archive.canonical.com/ubuntu'
default['openstack']['apt']['components'] = ["#{node['lsb']['codename']}-updates/#{node['openstack']['release']}", 'main']

View File

@@ -21,6 +21,10 @@
platform_options = node['openstack']['common']['platform']
case node['platform_family']
when 'debian'
if node['openstack']['apt']['update_apt_cache']
# Ensure we've done an apt-update first or packages won't be found.
include_recipe 'apt'
end
package 'ubuntu-cloud-keyring' do
options platform_options['package_overrides']
action :upgrade

View File

@@ -11,6 +11,15 @@ describe 'openstack-common::default' do
runner.converge(described_recipe)
end
it 'includes apt for apt-get update' do
node.set['openstack']['apt']['update_apt_cache'] = 'true'
expect(chef_run).to include_recipe 'apt'
end
it 'doesnt include apt for apt-get update' do
expect(chef_run).to_not include_recipe 'apt'
end
it 'upgrades ubuntu-cloud-keyring package' do
expect(chef_run).to upgrade_package 'ubuntu-cloud-keyring'
end