Allow packages to be updatable

In order for package updates to occur, package resources need to use
the upgrade action.  This is first phase of blueprint, to get some
consistency, next phase is to allow some update control.

Change-Id: Id4d2bebc9ddfce4c641828129c7157616c1174f0
Implements: blueprint allow-package-updates
This commit is contained in:
Mark Vanderwiel 2014-05-01 17:19:15 -05:00
parent 50cc4e97e8
commit 90bf06ab0b
10 changed files with 34 additions and 23 deletions

View File

@ -1,6 +1,9 @@
# CHANGELOG for cookbook-openstack-image
This file is used to list changes made in each version of cookbook-openstack-image.
## 9.0.2
* Fix package action to allow updates
## 9.0.1
* Remove policy template

View File

@ -3,7 +3,7 @@ maintainer 'Opscode, Inc.'
license 'Apache 2.0'
description 'Installs and configures the Glance Image Registry and Delivery Service'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '9.0.1'
version '9.0.2'
recipe 'openstack-image::api', 'Installs packages required for a glance api server'
recipe 'openstack-image::client', 'Install packages required for glance client'
recipe 'openstack-image::registry', 'Installs packages required for a glance registry server'

View File

@ -35,11 +35,13 @@ end
platform_options = node['openstack']['image']['platform']
package 'python-keystone' do
action :install
options platform_options['package_overrides']
action :upgrade
end
package 'curl' do
action :install
options platform_options['package_overrides']
action :upgrade
end
platform_options['image_packages'].each do |pkg|

View File

@ -30,7 +30,8 @@ end
platform_options = node['openstack']['image']['platform']
package 'python-keystone' do
action :install
options platform_options['package_overrides']
action :upgrade
end
db_user = node['openstack']['db']['image']['username']
@ -45,14 +46,15 @@ service_pass = get_password 'service', 'openstack-image'
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['registry']['auth']['version']
package 'curl' do
action :install
options platform_options['package_overrides']
action :upgrade
end
pkg_key = "#{node['openstack']['db']['image']['service_type']}_python_packages"
if platform_options.key?(pkg_key)
platform_options[pkg_key].each do |pkg|
package pkg do
action :install
action :upgrade
options platform_options['package_overrides']
end
end

View File

@ -11,6 +11,10 @@ describe 'openstack-image::api' do
include_context 'image-stubs'
it 'does upgrade keystone package' do
expect(chef_run).to upgrade_package('python-keystone')
end
it 'does not upgrade swift packages by default' do
expect(chef_run).not_to upgrade_package('openstack-swift')
end

View File

@ -11,7 +11,7 @@ describe 'openstack-image::client' do
runner.converge(described_recipe)
end
it 'installs packages' do
it 'upgrades python glance client package' do
expect(chef_run).to upgrade_package('python-glanceclient')
end
end

View File

@ -11,7 +11,7 @@ describe 'openstack-image::client' do
runner.converge(described_recipe)
end
it 'installs packages' do
it 'upgrades python glance client package' do
expect(chef_run).to upgrade_package('python-glanceclient')
end
end

View File

@ -17,19 +17,19 @@ describe 'openstack-image::registry' do
expect { chef_run }.to_not raise_error
end
it 'installs mysql python packages' do
expect(chef_run).to install_package('MySQL-python')
it 'upgrades mysql python package' do
expect(chef_run).to upgrade_package('MySQL-python')
end
it 'installs db2 python packages if explicitly told' do
it 'upgrades db2 python packages if explicitly told' do
node.set['openstack']['db']['image']['service_type'] = 'db2'
['python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
expect(chef_run).to install_package(pkg)
expect(chef_run).to upgrade_package(pkg)
end
end
it 'installs glance packages' do
it 'upgrades glance packages' do
expect(chef_run).to upgrade_package('openstack-glance')
expect(chef_run).to upgrade_package('cronie')
end

View File

@ -27,23 +27,23 @@ describe 'openstack-image::registry' do
expect { chef_run }.to_not raise_error
end
it 'installs mysql python packages' do
expect(chef_run).to install_package('python-mysqldb')
it 'upgrades mysql python package' do
expect(chef_run).to upgrade_package('python-mysqldb')
end
it 'honors package name and option overrides for mysql python packages' do
node.set['openstack']['image']['platform']['package_overrides'] = '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes'
node.set['openstack']['image']['platform']['mysql_python_packages'] = ['my-mysql-py']
expect(chef_run).to install_package('my-mysql-py').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
expect(chef_run).to upgrade_package('my-mysql-py').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
end
%w{db2 postgresql}.each do |service_type|
it "installs #{service_type} python packages if chosen" do
it "upgrades #{service_type} python packages if chosen" do
node.set['openstack']['db']['image']['service_type'] = service_type
node.set['openstack']['image']['platform']["#{service_type}_python_packages"] = ["my-#{service_type}-py"]
expect(chef_run).to install_package("my-#{service_type}-py")
expect(chef_run).to upgrade_package("my-#{service_type}-py")
end
end

View File

@ -64,15 +64,15 @@ shared_examples 'common-logging-recipe' do
end
shared_examples 'common-packages' do
it 'installs python-keystone package' do
expect(chef_run).to install_package 'python-keystone'
it 'upgrades python-keystone package' do
expect(chef_run).to upgrade_package 'python-keystone'
end
it 'installs curl package' do
expect(chef_run).to install_package 'curl'
it 'upgrades curl package' do
expect(chef_run).to upgrade_package 'curl'
end
it 'installs glance packages' do
it 'upgrades glance package' do
expect(chef_run).to upgrade_package 'glance'
end