Stein fixes

- Cookstyle fixes
- Refactor Berksfile to use groups so we can exclude integration testing
  cookbooks
- Update documentation
- Enable sensitive resources for the template[/etc/cinder/cinder.conf]
  and to resources improve security.
- Update delivery configuration to exclude integration cookbooks
- Fix ChefSpec output.
- Switch package installations to send packages as arrays instead of individual
  package resources. This generally speeds up chef runs.

Depends-On: https://review.opendev.org/701027
Depends-On: https://review.opendev.org/706151
Depends-On: https://review.opendev.org/706157
Change-Id: I73948a67e798477cfe7d3cf62474d0ea96f90db2
This commit is contained in:
Lance Albertson 2020-03-17 15:26:31 -07:00
parent 873b58d13b
commit 1b39032b8d
26 changed files with 172 additions and 211 deletions

View File

@ -1 +1,9 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml" [local_phases]
unit = 'rspec spec/'
lint = 'cookstyle --display-cop-names --extra-details'
syntax = "berks install -e integration"
provision = "echo skipping"
deploy = "echo skipping"
smoke = "echo skipping"
functional = "echo skipping"
cleanup = "echo skipping"

View File

@ -1,5 +1,3 @@
inherit_from: .rubocop_todo.yml
AllCops: AllCops:
Include: Include:
- metadata.rb - metadata.rb
@ -14,17 +12,3 @@ AllCops:
- .cookbooks/**/* - .cookbooks/**/*
- berks-cookbooks/**/* - berks-cookbooks/**/*
- .bundle/**/* - .bundle/**/*
Encoding:
Exclude:
- metadata.rb
- Gemfile
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3

View File

@ -1,20 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-08-03 05:25:43 -0700 using RuboCop version 0.55.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 2
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'attributes/cinder_conf.rb'
- 'recipes/cinder-common.rb'
# Offense count: 58
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 141

View File

@ -2,21 +2,21 @@ source 'https://supermarket.chef.io'
solver :ruby, :required solver :ruby, :required
%w( [
client %w(client dep),
-common %w(-common dep),
-dns %w(-dns integration),
-identity %w(-identity dep),
-image %w(-image dep),
-integration-test %w(-integration-test integration),
-network %w(-network integration),
-ops-database %w(-ops-database integration),
-ops-messaging %w(-ops-messaging integration),
).each do |cookbook| ].each do |cookbook, group|
if Dir.exist?("../cookbook-openstack#{cookbook}") if Dir.exist?("../cookbook-openstack#{cookbook}")
cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}" cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group
else else
cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}" cookbook "openstack#{cookbook}", git: "https://opendev.org/openstack/cookbook-openstack#{cookbook}", group: group
end end
end end

View File

@ -20,9 +20,9 @@ https://docs.openstack.org/cinder/latest/
Requirements Requirements
============ ============
- Chef 14 or higher - Chef 15 or higher
- chefdk 3.2.30 for testing (also includes berkshelf for cookbook - Chef Workstation 0.15.18 for testing (also includes berkshelf for
dependency resolution) cookbook dependency resolution)
Platform Platform
======== ========
@ -39,9 +39,9 @@ The following cookbooks are dependencies:
- 'apache2', '~> 8.0' - 'apache2', '~> 8.0'
- 'lvm' - 'lvm'
- 'openstackclient' - 'openstackclient'
- 'openstack-common', '>= 18.0.0' - 'openstack-common', '>= 19.0.0'
- 'openstack-identity', '>= 18.0.0' - 'openstack-identity', '>= 19.0.0'
- 'openstack-image', '>= 18.0.0' - 'openstack-image', '>= 19.0.0'
Attributes Attributes
========== ==========
@ -152,7 +152,7 @@ License and Author
+-----------------+---------------------------------------------------+ +-----------------+---------------------------------------------------+
| **Copyright** | Copyright (c) 2013-2015, IBM, Corp. | | **Copyright** | Copyright (c) 2013-2015, IBM, Corp. |
+-----------------+---------------------------------------------------+ +-----------------+---------------------------------------------------+
| **Copyright** | Copyright (c) 2019, Oregon State University | | **Copyright** | Copyright (c) 2019-2020, Oregon State University |
+-----------------+---------------------------------------------------+ +-----------------+---------------------------------------------------+
Licensed under the Apache License, Version 2.0 (the "License"); you may Licensed under the Apache License, Version 2.0 (the "License"); you may

View File

@ -1,13 +1,14 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Attributes:: default # Attributes:: default
# #
# Copyright 2012, DreamHost # Copyright:: 2012, DreamHost
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc. # Copyright:: 2013, Opscode, Inc.
# Copyright 2013-2014, IBM, Corp # Copyright:: 2013-2014, IBM, Corp
# Copyright:: 2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -87,34 +88,45 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['block-storage']['volume']['iscsi_helper'] = 'lioadm' default['openstack']['block-storage']['volume']['iscsi_helper'] = 'lioadm'
default['openstack']['block-storage']['platform'] = { default['openstack']['block-storage']['platform'] = {
'cinder_common_packages' => ['openstack-cinder'], 'cinder_common_packages' => ['openstack-cinder'],
'cinder_api_packages' => ['openstack-cinder', 'mod_wsgi'], 'cinder_api_packages' => %w(openstack-cinder mod_wsgi),
'cinder_api_service' => 'openstack-cinder-api', 'cinder_api_service' => 'openstack-cinder-api',
'cinder_volume_packages' => ['qemu-img-ev'], 'cinder_volume_packages' => %w(qemu-img-ev),
'cinder_volume_service' => 'openstack-cinder-volume', 'cinder_volume_service' => 'openstack-cinder-volume',
'cinder_scheduler_packages' => [], 'cinder_scheduler_packages' => [],
'cinder_scheduler_service' => 'openstack-cinder-scheduler', 'cinder_scheduler_service' => 'openstack-cinder-scheduler',
'cinder_backup_packages' => [], 'cinder_backup_packages' => [],
'cinder_backup_service' => 'openstack-cinder-backup', 'cinder_backup_service' => 'openstack-cinder-backup',
'cinder_iscsitarget_packages' => ['targetcli', 'dbus-python'], 'cinder_iscsitarget_packages' => %w(targetcli dbus-python),
'cinder_iscsitarget_service' => 'target', 'cinder_iscsitarget_service' => 'target',
'cinder_lvm_packages' => ['lvm2'], 'cinder_lvm_packages' => %w(lvm2),
'package_overrides' => '', 'package_overrides' => '',
} }
when 'debian' when 'debian'
# operating system user and group names # operating system user and group names
default['openstack']['block-storage']['platform'] = { default['openstack']['block-storage']['platform'] = {
'cinder_common_packages' => ['cinder-common'], 'cinder_common_packages' => %w(cinder-common),
'cinder_api_packages' => ['libapache2-mod-wsgi-py3', 'python3-cinder', 'cinder-api'], 'cinder_api_packages' =>
%w(
libapache2-mod-wsgi-py3
python3-cinder
cinder-api
),
'cinder_api_service' => 'cinder-api', 'cinder_api_service' => 'cinder-api',
'cinder_volume_packages' => ['python3-cinder', 'cinder-volume', 'qemu-utils', 'thin-provisioning-tools'], 'cinder_volume_packages' =>
%w(
python3-cinder
cinder-volume
qemu-utils
thin-provisioning-tools
),
'cinder_volume_service' => 'cinder-volume', 'cinder_volume_service' => 'cinder-volume',
'cinder_scheduler_packages' => ['python3-cinder', 'cinder-scheduler'], 'cinder_scheduler_packages' => %w(python3-cinder cinder-scheduler),
'cinder_scheduler_service' => 'cinder-scheduler', 'cinder_scheduler_service' => 'cinder-scheduler',
'cinder_backup_packages' => ['python3-cinder', 'cinder-backup'], 'cinder_backup_packages' => %w(python3-cinder cinder-backup),
'cinder_backup_service' => 'cinder-backup', 'cinder_backup_service' => 'cinder-backup',
'cinder_iscsitarget_packages' => ['targetcli-fb'], 'cinder_iscsitarget_packages' => %w(targetcli-fb),
'cinder_iscsitarget_service' => 'tgt', 'cinder_iscsitarget_service' => 'tgt',
'cinder_lvm_packages' => ['lvm2'], 'cinder_lvm_packages' => %w(lvm2),
'package_overrides' => '', 'package_overrides' => '',
} }
end end

View File

@ -3,15 +3,7 @@ maintainer 'Chef OpenStack'
maintainer_email 'openstack-discuss@lists.openstack.org' maintainer_email 'openstack-discuss@lists.openstack.org'
license 'Apache-2.0' license 'Apache-2.0'
description 'The OpenStack Advanced Volume Management service Cinder.' description 'The OpenStack Advanced Volume Management service Cinder.'
version '18.0.0' version '19.0.0'
recipe 'api', 'Installs the cinder-api and sets up the cinder database'
recipe 'backup', 'Installs the cinder-backup service'
recipe 'cinder-common', 'Defines the common pieces of repeated code from the other recipes'
recipe 'identity_registration', 'Defines the cinder service/user/endpoints in keystone'
recipe 'scheduler', 'Installs the cinder-scheduler service'
recipe 'volume_driver_lvm', 'Configures lvm as the cinder storage backend'
recipe 'volume', 'Installs the cinder-volume service'
%w(ubuntu redhat centos).each do |os| %w(ubuntu redhat centos).each do |os|
supports os supports os
@ -20,10 +12,10 @@ end
depends 'apache2', '~> 8.0' depends 'apache2', '~> 8.0'
depends 'lvm' depends 'lvm'
depends 'openstackclient' depends 'openstackclient'
depends 'openstack-common', '>= 18.0.0' depends 'openstack-common', '>= 19.0.0'
depends 'openstack-identity', '>= 18.0.0' depends 'openstack-identity', '>= 19.0.0'
depends 'openstack-image', '>= 18.0.0' depends 'openstack-image', '>= 19.0.0'
issues_url 'https://launchpad.net/openstack-chef' issues_url 'https://launchpad.net/openstack-chef'
source_url 'https://opendev.org/openstack/cookbook-openstack-block-storage' source_url 'https://opendev.org/openstack/cookbook-openstack-block-storage'
chef_version '>= 14.0' chef_version '>= 15.0'

View File

@ -1,12 +1,13 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Recipe:: api # Recipe:: api
# #
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc. # Copyright:: 2013, Opscode, Inc.
# Copyright 2013-2014, SUSE Linux Gmbh. # Copyright:: 2013-2014, SUSE Linux Gmbh.
# Copyright:: 2019-2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -41,18 +42,14 @@ file '/etc/apache2/conf-available/cinder-wsgi.conf' do
only_if { platform_family? 'debian' } only_if { platform_family? 'debian' }
end end
platform_options['cinder_api_packages'].each do |pkg| package platform_options['cinder_api_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
db_type = node['openstack']['db']['block_storage']['service_type'] db_type = node['openstack']['db']['block_storage']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg| package node['openstack']['db']['python_packages'][db_type] do
package pkg do action :upgrade
action :upgrade
end
end end
execute 'cinder-manage db sync' do execute 'cinder-manage db sync' do
@ -65,7 +62,7 @@ if node['openstack']['block-storage']['policyfile_url']
source node['openstack']['block-storage']['policyfile_url'] source node['openstack']['block-storage']['policyfile_url']
owner node['openstack']['block-storage']['user'] owner node['openstack']['block-storage']['user']
group node['openstack']['block-storage']['group'] group node['openstack']['block-storage']['group']
mode 0o0644 mode '644'
end end
end end

View File

@ -1,8 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Recipe:: backup # Recipe:: backup
# #
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -20,18 +22,14 @@ include_recipe 'openstack-block-storage::cinder-common'
platform_options = node['openstack']['block-storage']['platform'] platform_options = node['openstack']['block-storage']['platform']
platform_options['cinder_backup_packages'].each do |pkg| package platform_options['cinder_backup_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
db_type = node['openstack']['db']['block_storage']['service_type'] db_type = node['openstack']['db']['block_storage']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg| package node['openstack']['db']['python_packages'][db_type] do
package pkg do action :upgrade
action :upgrade
end
end end
service 'cinder-backup' do service 'cinder-backup' do

View File

@ -1,5 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook:: openstack-block-storage
# Recipe:: cinder-common
#
# Copyright:: 2019-2020, Oregon State Univerity
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -22,11 +27,9 @@ end
platform_options = node['openstack']['block-storage']['platform'] platform_options = node['openstack']['block-storage']['platform']
platform_options['cinder_common_packages'].each do |pkg| package platform_options['cinder_common_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
db_user = node['openstack']['db']['block_storage']['username'] db_user = node['openstack']['db']['block_storage']['username']
@ -42,7 +45,8 @@ if node['openstack']['endpoints']['db']['enabled_slave']
end end
if node['openstack']['mq']['service_type'] == 'rabbit' if node['openstack']['mq']['service_type'] == 'rabbit'
node.default['openstack']['block-storage']['conf_secrets']['DEFAULT']['transport_url'] = rabbit_transport_url 'block_storage' node.default['openstack']['block-storage']['conf_secrets']['DEFAULT']['transport_url'] =
rabbit_transport_url 'block_storage'
end end
glance_api_endpoint = internal_endpoint 'image_api' glance_api_endpoint = internal_endpoint 'image_api'
@ -58,7 +62,7 @@ auth_url = ::URI.decode identity_endpoint.to_s
directory '/etc/cinder' do directory '/etc/cinder' do
group node['openstack']['block-storage']['group'] group node['openstack']['block-storage']['group']
owner node['openstack']['block-storage']['user'] owner node['openstack']['block-storage']['user']
mode 0o0750 mode '750'
action :create action :create
end end
@ -98,7 +102,8 @@ template '/etc/cinder/cinder.conf' do
cookbook 'openstack-common' cookbook 'openstack-common'
group node['openstack']['block-storage']['group'] group node['openstack']['block-storage']['group']
owner node['openstack']['block-storage']['user'] owner node['openstack']['block-storage']['user']
mode 0o0640 mode '640'
sensitive true
variables( variables(
service_config: cinder_conf_options service_config: cinder_conf_options
) )
@ -117,7 +122,7 @@ directory node['openstack']['block-storage']['conf']['oslo_concurrency']['lock_p
group node['openstack']['block-storage']['group'] group node['openstack']['block-storage']['group']
owner node['openstack']['block-storage']['user'] owner node['openstack']['block-storage']['user']
recursive true recursive true
mode 0o0755 mode '755'
end end
if node['openstack']['block-storage']['use_rootwrap'] if node['openstack']['block-storage']['use_rootwrap']
@ -126,7 +131,7 @@ if node['openstack']['block-storage']['use_rootwrap']
cookbook 'openstack-common' cookbook 'openstack-common'
owner 'root' owner 'root'
group 'root' group 'root'
mode 0o0644 mode '644'
variables( variables(
service_config: node['openstack']['block-storage']['rootwrap']['conf'] service_config: node['openstack']['block-storage']['rootwrap']['conf']
) )

View File

@ -1,11 +1,12 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Recipe:: identity_registration # Recipe:: identity_registration
# #
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc. # Copyright:: 2013, Opscode, Inc.
# Copyright:: 2019, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -47,11 +48,11 @@ service_name = node['openstack']['block-storage']['service_name']
service_type = node['openstack']['block-storage']['service_type'] service_type = node['openstack']['block-storage']['service_type']
connection_params = { connection_params = {
openstack_auth_url: auth_url, openstack_auth_url: auth_url,
openstack_username: admin_user, openstack_username: admin_user,
openstack_api_key: admin_pass, openstack_api_key: admin_pass,
openstack_project_name: admin_project, openstack_project_name: admin_project,
openstack_domain_name: admin_domain, openstack_domain_name: admin_domain,
} }
# Register Volume Service # Register Volume Service

View File

@ -1,12 +1,13 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Recipe:: scheduler # Recipe:: scheduler
# #
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc. # Copyright:: 2013, Opscode, Inc.
# Copyright 2013-2014, SUSE Linux Gmbh. # Copyright:: 2013-2014, SUSE Linux Gmbh.
# Copyright:: 2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -25,18 +26,14 @@ include_recipe 'openstack-block-storage::cinder-common'
platform_options = node['openstack']['block-storage']['platform'] platform_options = node['openstack']['block-storage']['platform']
platform_options['cinder_scheduler_packages'].each do |pkg| package platform_options['cinder_scheduler_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
db_type = node['openstack']['db']['block_storage']['service_type'] db_type = node['openstack']['db']['block_storage']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg| package node['openstack']['db']['python_packages'][db_type] do
package pkg do action :upgrade
action :upgrade
end
end end
service 'cinder-scheduler' do service 'cinder-scheduler' do

View File

@ -1,13 +1,14 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Recipe:: volume # Recipe:: volume
# #
# Copyright 2012, Rackspace US, Inc. # Copyright:: 2012, Rackspace US, Inc.
# Copyright 2012-2013, AT&T Services, Inc. # Copyright:: 2012-2013, AT&T Services, Inc.
# Copyright 2013, Opscode, Inc. # Copyright:: 2013, Opscode, Inc.
# Copyright 2013-2014, SUSE Linux Gmbh. # Copyright:: 2013-2014, SUSE Linux Gmbh.
# Copyright 2013, IBM, Corp. # Copyright:: 2013, IBM, Corp.
# Copyright:: 2020, Oregon State University
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -31,25 +32,19 @@ include_recipe 'openstack-block-storage::cinder-common'
platform_options = node['openstack']['block-storage']['platform'] platform_options = node['openstack']['block-storage']['platform']
platform_options['cinder_volume_packages'].each do |pkg| package platform_options['cinder_volume_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
db_type = node['openstack']['db']['block_storage']['service_type'] db_type = node['openstack']['db']['block_storage']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg| package node['openstack']['db']['python_packages'][db_type] do
package pkg do action :upgrade
action :upgrade
end
end end
platform_options['cinder_iscsitarget_packages'].each do |pkg| package platform_options['cinder_iscsitarget_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
service 'cinder-volume' do service 'cinder-volume' do

View File

@ -1,8 +1,10 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
# Recipe:: volume_driver_lvm # Recipe:: volume_driver_lvm
# #
# Copyright:: 2020, Oregon State University
#
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
@ -17,11 +19,9 @@
# #
platform_options = node['openstack']['block-storage']['platform'] platform_options = node['openstack']['block-storage']['platform']
platform_options['cinder_lvm_packages'].each do |pkg| package platform_options['cinder_lvm_packages'] do
package pkg do options platform_options['package_overrides']
options platform_options['package_overrides'] action :upgrade
action :upgrade
end
end end
# TODO: (jklare) this whole section should be refactored and probably include an # TODO: (jklare) this whole section should be refactored and probably include an

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -16,9 +16,8 @@ describe 'openstack-block-storage::api' do
expect(chef_run).to_not create_file('/etc/apache2/conf-available/cinder-wsgi.conf') expect(chef_run).to_not create_file('/etc/apache2/conf-available/cinder-wsgi.conf')
end end
it 'upgrades cinder api package' do it do
expect(chef_run).to upgrade_package 'openstack-cinder' expect(chef_run).to upgrade_package %w(openstack-cinder mod_wsgi)
expect(chef_run).to upgrade_package 'mod_wsgi'
end end
it 'upgrades mysql python package' do it 'upgrades mysql python package' do

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -23,10 +23,8 @@ describe 'openstack-block-storage::api' do
) )
end end
it 'upgrades cinder api packages' do it do
expect(chef_run).to upgrade_package('libapache2-mod-wsgi-py3') expect(chef_run).to upgrade_package %w(libapache2-mod-wsgi-py3 python3-cinder cinder-api)
expect(chef_run).to upgrade_package('python3-cinder')
expect(chef_run).to upgrade_package('cinder-api')
end end
it 'upgrades mysql python3 package' do it 'upgrades mysql python3 package' do
@ -162,7 +160,7 @@ describe 'openstack-block-storage::api' do
expect(chef_run).to create_remote_file('/etc/cinder/policy.json').with( expect(chef_run).to create_remote_file('/etc/cinder/policy.json').with(
user: 'cinder', user: 'cinder',
group: 'cinder', group: 'cinder',
mode: 0o0644 mode: '644'
) )
end end
end end

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -13,8 +13,8 @@ describe 'openstack-block-storage::backup' do
include_context 'block-storage-stubs' include_context 'block-storage-stubs'
describe 'enable cinder backup service' do describe 'enable cinder backup service' do
it 'upgrades cinder backup package' do it do
expect(chef_run).to upgrade_package 'cinder-backup' expect(chef_run).to upgrade_package %w(python3-cinder cinder-backup)
end end
it 'starts cinder backup' do it 'starts cinder backup' do

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'

View File

@ -1,6 +1,6 @@
# encoding: utf-8 # encoding: utf-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -36,7 +36,7 @@ describe 'openstack-block-storage::cinder-common' do
expect(chef_run).to create_directory(dir.name).with( expect(chef_run).to create_directory(dir.name).with(
owner: 'cinder', owner: 'cinder',
group: 'cinder', group: 'cinder',
mode: 0o0750 mode: '750'
) )
end end
end end
@ -46,9 +46,12 @@ describe 'openstack-block-storage::cinder-common' do
it 'should create the cinder.conf template' do it 'should create the cinder.conf template' do
expect(chef_run).to create_template(file.name).with( expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
owner: 'cinder', owner: 'cinder',
group: 'cinder', group: 'cinder',
mode: 0o0640 mode: '640',
sensitive: true
) )
end end
@ -168,7 +171,7 @@ describe 'openstack-block-storage::cinder-common' do
expect(chef_run).to create_directory(dir.name).with( expect(chef_run).to create_directory(dir.name).with(
user: 'cinder', user: 'cinder',
group: 'cinder', group: 'cinder',
mode: 0o0755 mode: '755'
) )
end end
end end
@ -180,7 +183,7 @@ describe 'openstack-block-storage::cinder-common' do
expect(chef_run).to create_template(file.name).with( expect(chef_run).to create_template(file.name).with(
user: 'root', user: 'root',
group: 'root', group: 'root',
mode: 0o644 mode: '644'
) )
end end

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -14,8 +14,8 @@ describe 'openstack-block-storage::scheduler' do
include_examples 'common-logging' include_examples 'common-logging'
include_examples 'creates_cinder_conf', 'service[cinder-scheduler]', 'cinder', 'cinder' include_examples 'creates_cinder_conf', 'service[cinder-scheduler]', 'cinder', 'cinder'
it 'upgrades cinder scheduler package' do it do
expect(chef_run).to upgrade_package 'cinder-scheduler' expect(chef_run).to upgrade_package %w(python3-cinder cinder-scheduler)
end end
it 'starts cinder scheduler' do it 'starts cinder scheduler' do

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require 'chefspec' require 'chefspec'
require 'chefspec/berkshelf' require 'chefspec/berkshelf'
@ -126,7 +126,7 @@ shared_examples 'creates_cinder_conf' do |service, user, group, action = :restar
expect(chef_run).to create_template(file.name).with( expect(chef_run).to create_template(file.name).with(
user: user, user: user,
group: group, group: group,
mode: 0o640 mode: '640'
) )
end end

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -20,8 +20,8 @@ describe 'openstack-block-storage::volume' do
expect(chef_run).to upgrade_package('qemu-img-ev') expect(chef_run).to upgrade_package('qemu-img-ev')
end end
it 'upgrades cinder iscsi package' do it do
expect(chef_run).to upgrade_package('targetcli') expect(chef_run).to upgrade_package %w(targetcli dbus-python)
end end
it 'starts cinder volume' do it 'starts cinder volume' do

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
# #
# Cookbook Name:: openstack-block-storage # Cookbook:: openstack-block-storage
require_relative 'spec_helper' require_relative 'spec_helper'
@ -14,16 +14,8 @@ describe 'openstack-block-storage::volume' do
include_examples 'common-logging' include_examples 'common-logging'
include_examples 'creates_cinder_conf', 'service[cinder-volume]', 'cinder', 'cinder' include_examples 'creates_cinder_conf', 'service[cinder-volume]', 'cinder', 'cinder'
it 'upgrades cinder volume packages' do it do
expect(chef_run).to upgrade_package 'cinder-volume' expect(chef_run).to upgrade_package %w(python3-cinder cinder-volume qemu-utils thin-provisioning-tools)
end
it 'upgrades qemu utils package' do
expect(chef_run).to upgrade_package 'qemu-utils'
end
it 'upgrades thin provisioning tools package' do
expect(chef_run).to upgrade_package 'thin-provisioning-tools'
end end
it 'starts cinder volume' do it 'starts cinder volume' do