diff --git a/.delivery/project.toml b/.delivery/project.toml index 6d5e361..4066e55 100644 --- a/.delivery/project.toml +++ b/.delivery/project.toml @@ -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" diff --git a/.rubocop.yml b/.rubocop.yml index 5e0be9f..8d19f13 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,3 @@ -inherit_from: .rubocop_todo.yml - AllCops: Include: - metadata.rb @@ -14,17 +12,3 @@ AllCops: - .cookbooks/**/* - berks-cookbooks/**/* - .bundle/**/* - -Encoding: - Exclude: - - metadata.rb - - Gemfile - -NumericLiterals: - Enabled: false - -LineLength: - Enabled: false - -WordArray: - MinSize: 3 diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 952f3ec..0000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -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 diff --git a/Berksfile b/Berksfile index 0a71871..745aef5 100644 --- a/Berksfile +++ b/Berksfile @@ -2,21 +2,21 @@ source 'https://supermarket.chef.io' solver :ruby, :required -%w( - client - -common - -dns - -identity - -image - -integration-test - -network - -ops-database - -ops-messaging -).each do |cookbook| +[ + %w(client dep), + %w(-common dep), + %w(-dns integration), + %w(-identity dep), + %w(-image dep), + %w(-integration-test integration), + %w(-network integration), + %w(-ops-database integration), + %w(-ops-messaging integration), +].each do |cookbook, group| if Dir.exist?("../cookbook-openstack#{cookbook}") - cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}" + cookbook "openstack#{cookbook}", path: "../cookbook-openstack#{cookbook}", group: group 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 diff --git a/README.rst b/README.rst index 19d94ab..b34f497 100644 --- a/README.rst +++ b/README.rst @@ -20,9 +20,9 @@ https://docs.openstack.org/cinder/latest/ Requirements ============ -- Chef 14 or higher -- chefdk 3.2.30 for testing (also includes berkshelf for cookbook - dependency resolution) +- Chef 15 or higher +- Chef Workstation 0.15.18 for testing (also includes berkshelf for + cookbook dependency resolution) Platform ======== @@ -39,9 +39,9 @@ The following cookbooks are dependencies: - 'apache2', '~> 8.0' - 'lvm' - 'openstackclient' -- 'openstack-common', '>= 18.0.0' -- 'openstack-identity', '>= 18.0.0' -- 'openstack-image', '>= 18.0.0' +- 'openstack-common', '>= 19.0.0' +- 'openstack-identity', '>= 19.0.0' +- 'openstack-image', '>= 19.0.0' Attributes ========== @@ -152,7 +152,7 @@ License and Author +-----------------+---------------------------------------------------+ | **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 diff --git a/attributes/default.rb b/attributes/default.rb index 91f8dfa..85254ba 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,13 +1,14 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Attributes:: default # -# Copyright 2012, DreamHost -# Copyright 2012, Rackspace US, Inc. -# Copyright 2012-2013, AT&T Services, Inc. -# Copyright 2013, Opscode, Inc. -# Copyright 2013-2014, IBM, Corp +# Copyright:: 2012, DreamHost +# Copyright:: 2012, Rackspace US, Inc. +# Copyright:: 2012-2013, AT&T Services, Inc. +# Copyright:: 2013, Opscode, Inc. +# Copyright:: 2013-2014, IBM, Corp +# Copyright:: 2020, Oregon State University # # Licensed under the Apache License, Version 2.0 (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']['platform'] = { '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_volume_packages' => ['qemu-img-ev'], + 'cinder_volume_packages' => %w(qemu-img-ev), 'cinder_volume_service' => 'openstack-cinder-volume', 'cinder_scheduler_packages' => [], 'cinder_scheduler_service' => 'openstack-cinder-scheduler', 'cinder_backup_packages' => [], 'cinder_backup_service' => 'openstack-cinder-backup', - 'cinder_iscsitarget_packages' => ['targetcli', 'dbus-python'], + 'cinder_iscsitarget_packages' => %w(targetcli dbus-python), 'cinder_iscsitarget_service' => 'target', - 'cinder_lvm_packages' => ['lvm2'], + 'cinder_lvm_packages' => %w(lvm2), 'package_overrides' => '', } when 'debian' # operating system user and group names default['openstack']['block-storage']['platform'] = { - 'cinder_common_packages' => ['cinder-common'], - 'cinder_api_packages' => ['libapache2-mod-wsgi-py3', 'python3-cinder', 'cinder-api'], + 'cinder_common_packages' => %w(cinder-common), + 'cinder_api_packages' => + %w( + libapache2-mod-wsgi-py3 + python3-cinder + 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_scheduler_packages' => ['python3-cinder', 'cinder-scheduler'], + 'cinder_scheduler_packages' => %w(python3-cinder 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_iscsitarget_packages' => ['targetcli-fb'], + 'cinder_iscsitarget_packages' => %w(targetcli-fb), 'cinder_iscsitarget_service' => 'tgt', - 'cinder_lvm_packages' => ['lvm2'], + 'cinder_lvm_packages' => %w(lvm2), 'package_overrides' => '', } end diff --git a/metadata.rb b/metadata.rb index 67316e6..4efe305 100644 --- a/metadata.rb +++ b/metadata.rb @@ -3,15 +3,7 @@ maintainer 'Chef OpenStack' maintainer_email 'openstack-discuss@lists.openstack.org' license 'Apache-2.0' description 'The OpenStack Advanced Volume Management service Cinder.' -version '18.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' +version '19.0.0' %w(ubuntu redhat centos).each do |os| supports os @@ -20,10 +12,10 @@ end depends 'apache2', '~> 8.0' depends 'lvm' depends 'openstackclient' -depends 'openstack-common', '>= 18.0.0' -depends 'openstack-identity', '>= 18.0.0' -depends 'openstack-image', '>= 18.0.0' +depends 'openstack-common', '>= 19.0.0' +depends 'openstack-identity', '>= 19.0.0' +depends 'openstack-image', '>= 19.0.0' issues_url 'https://launchpad.net/openstack-chef' source_url 'https://opendev.org/openstack/cookbook-openstack-block-storage' -chef_version '>= 14.0' +chef_version '>= 15.0' diff --git a/recipes/api.rb b/recipes/api.rb index a6f822f..9110a31 100644 --- a/recipes/api.rb +++ b/recipes/api.rb @@ -1,12 +1,13 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Recipe:: api # -# Copyright 2012, Rackspace US, Inc. -# Copyright 2012-2013, AT&T Services, Inc. -# Copyright 2013, Opscode, Inc. -# Copyright 2013-2014, SUSE Linux Gmbh. +# Copyright:: 2012, Rackspace US, Inc. +# Copyright:: 2012-2013, AT&T Services, Inc. +# Copyright:: 2013, Opscode, Inc. +# Copyright:: 2013-2014, SUSE Linux Gmbh. +# Copyright:: 2019-2020, Oregon State University # # Licensed under the Apache License, Version 2.0 (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' } end -platform_options['cinder_api_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_api_packages'] do + options platform_options['package_overrides'] + action :upgrade end db_type = node['openstack']['db']['block_storage']['service_type'] -node['openstack']['db']['python_packages'][db_type].each do |pkg| - package pkg do - action :upgrade - end +package node['openstack']['db']['python_packages'][db_type] do + action :upgrade end execute 'cinder-manage db sync' do @@ -65,7 +62,7 @@ if node['openstack']['block-storage']['policyfile_url'] source node['openstack']['block-storage']['policyfile_url'] owner node['openstack']['block-storage']['user'] group node['openstack']['block-storage']['group'] - mode 0o0644 + mode '644' end end diff --git a/recipes/backup.rb b/recipes/backup.rb index 3c1b11a..fdd4bbe 100644 --- a/recipes/backup.rb +++ b/recipes/backup.rb @@ -1,8 +1,10 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Recipe:: backup # +# Copyright:: 2020, Oregon State University +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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['cinder_backup_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_backup_packages'] do + options platform_options['package_overrides'] + action :upgrade end db_type = node['openstack']['db']['block_storage']['service_type'] -node['openstack']['db']['python_packages'][db_type].each do |pkg| - package pkg do - action :upgrade - end +package node['openstack']['db']['python_packages'][db_type] do + action :upgrade end service 'cinder-backup' do diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb index 9383c7c..32372df 100644 --- a/recipes/cinder-common.rb +++ b/recipes/cinder-common.rb @@ -1,5 +1,10 @@ # 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"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -22,11 +27,9 @@ end platform_options = node['openstack']['block-storage']['platform'] -platform_options['cinder_common_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_common_packages'] do + options platform_options['package_overrides'] + action :upgrade end db_user = node['openstack']['db']['block_storage']['username'] @@ -42,7 +45,8 @@ if node['openstack']['endpoints']['db']['enabled_slave'] end 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 glance_api_endpoint = internal_endpoint 'image_api' @@ -58,7 +62,7 @@ auth_url = ::URI.decode identity_endpoint.to_s directory '/etc/cinder' do group node['openstack']['block-storage']['group'] owner node['openstack']['block-storage']['user'] - mode 0o0750 + mode '750' action :create end @@ -98,7 +102,8 @@ template '/etc/cinder/cinder.conf' do cookbook 'openstack-common' group node['openstack']['block-storage']['group'] owner node['openstack']['block-storage']['user'] - mode 0o0640 + mode '640' + sensitive true variables( 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'] owner node['openstack']['block-storage']['user'] recursive true - mode 0o0755 + mode '755' end if node['openstack']['block-storage']['use_rootwrap'] @@ -126,7 +131,7 @@ if node['openstack']['block-storage']['use_rootwrap'] cookbook 'openstack-common' owner 'root' group 'root' - mode 0o0644 + mode '644' variables( service_config: node['openstack']['block-storage']['rootwrap']['conf'] ) diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index cc338af..85fce44 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -1,11 +1,12 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Recipe:: identity_registration # -# Copyright 2012, Rackspace US, Inc. -# Copyright 2012-2013, AT&T Services, Inc. -# Copyright 2013, Opscode, Inc. +# Copyright:: 2012, Rackspace US, Inc. +# Copyright:: 2012-2013, AT&T Services, Inc. +# Copyright:: 2013, Opscode, Inc. +# Copyright:: 2019, Oregon State University # # Licensed under the Apache License, Version 2.0 (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'] connection_params = { - openstack_auth_url: auth_url, - openstack_username: admin_user, - openstack_api_key: admin_pass, + openstack_auth_url: auth_url, + openstack_username: admin_user, + openstack_api_key: admin_pass, openstack_project_name: admin_project, - openstack_domain_name: admin_domain, + openstack_domain_name: admin_domain, } # Register Volume Service diff --git a/recipes/scheduler.rb b/recipes/scheduler.rb index b9c7b34..c628dbc 100644 --- a/recipes/scheduler.rb +++ b/recipes/scheduler.rb @@ -1,12 +1,13 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Recipe:: scheduler # -# Copyright 2012, Rackspace US, Inc. -# Copyright 2012-2013, AT&T Services, Inc. -# Copyright 2013, Opscode, Inc. -# Copyright 2013-2014, SUSE Linux Gmbh. +# Copyright:: 2012, Rackspace US, Inc. +# Copyright:: 2012-2013, AT&T Services, Inc. +# Copyright:: 2013, Opscode, Inc. +# Copyright:: 2013-2014, SUSE Linux Gmbh. +# Copyright:: 2020, Oregon State University # # Licensed under the Apache License, Version 2.0 (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['cinder_scheduler_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_scheduler_packages'] do + options platform_options['package_overrides'] + action :upgrade end db_type = node['openstack']['db']['block_storage']['service_type'] -node['openstack']['db']['python_packages'][db_type].each do |pkg| - package pkg do - action :upgrade - end +package node['openstack']['db']['python_packages'][db_type] do + action :upgrade end service 'cinder-scheduler' do diff --git a/recipes/volume.rb b/recipes/volume.rb index 8127430..348516e 100644 --- a/recipes/volume.rb +++ b/recipes/volume.rb @@ -1,13 +1,14 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Recipe:: volume # -# Copyright 2012, Rackspace US, Inc. -# Copyright 2012-2013, AT&T Services, Inc. -# Copyright 2013, Opscode, Inc. -# Copyright 2013-2014, SUSE Linux Gmbh. -# Copyright 2013, IBM, Corp. +# Copyright:: 2012, Rackspace US, Inc. +# Copyright:: 2012-2013, AT&T Services, Inc. +# Copyright:: 2013, Opscode, Inc. +# Copyright:: 2013-2014, SUSE Linux Gmbh. +# Copyright:: 2013, IBM, Corp. +# Copyright:: 2020, Oregon State University # # Licensed under the Apache License, Version 2.0 (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['cinder_volume_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_volume_packages'] do + options platform_options['package_overrides'] + action :upgrade end db_type = node['openstack']['db']['block_storage']['service_type'] -node['openstack']['db']['python_packages'][db_type].each do |pkg| - package pkg do - action :upgrade - end +package node['openstack']['db']['python_packages'][db_type] do + action :upgrade end -platform_options['cinder_iscsitarget_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_iscsitarget_packages'] do + options platform_options['package_overrides'] + action :upgrade end service 'cinder-volume' do diff --git a/recipes/volume_driver_lvm.rb b/recipes/volume_driver_lvm.rb index db9dd2b..726da9d 100644 --- a/recipes/volume_driver_lvm.rb +++ b/recipes/volume_driver_lvm.rb @@ -1,8 +1,10 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage # Recipe:: volume_driver_lvm # +# Copyright:: 2020, Oregon State University +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -17,11 +19,9 @@ # platform_options = node['openstack']['block-storage']['platform'] -platform_options['cinder_lvm_packages'].each do |pkg| - package pkg do - options platform_options['package_overrides'] - action :upgrade - end +package platform_options['cinder_lvm_packages'] do + options platform_options['package_overrides'] + action :upgrade end # TODO: (jklare) this whole section should be refactored and probably include an diff --git a/spec/api-redhat_spec.rb b/spec/api-redhat_spec.rb index 221eee5..1c9005b 100644 --- a/spec/api-redhat_spec.rb +++ b/spec/api-redhat_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage 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') end - it 'upgrades cinder api package' do - expect(chef_run).to upgrade_package 'openstack-cinder' - expect(chef_run).to upgrade_package 'mod_wsgi' + it do + expect(chef_run).to upgrade_package %w(openstack-cinder mod_wsgi) end it 'upgrades mysql python package' do diff --git a/spec/api_spec.rb b/spec/api_spec.rb index 406ddf1..1d66078 100644 --- a/spec/api_spec.rb +++ b/spec/api_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' @@ -23,10 +23,8 @@ describe 'openstack-block-storage::api' do ) end - it 'upgrades cinder api packages' do - expect(chef_run).to upgrade_package('libapache2-mod-wsgi-py3') - expect(chef_run).to upgrade_package('python3-cinder') - expect(chef_run).to upgrade_package('cinder-api') + it do + expect(chef_run).to upgrade_package %w(libapache2-mod-wsgi-py3 python3-cinder cinder-api) end 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( user: 'cinder', group: 'cinder', - mode: 0o0644 + mode: '644' ) end end diff --git a/spec/backup-redhat_spec.rb b/spec/backup-redhat_spec.rb index ea36618..e6a8356 100644 --- a/spec/backup-redhat_spec.rb +++ b/spec/backup-redhat_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' diff --git a/spec/backup_spec.rb b/spec/backup_spec.rb index 4ca240e..6778aab 100644 --- a/spec/backup_spec.rb +++ b/spec/backup_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' @@ -13,8 +13,8 @@ describe 'openstack-block-storage::backup' do include_context 'block-storage-stubs' describe 'enable cinder backup service' do - it 'upgrades cinder backup package' do - expect(chef_run).to upgrade_package 'cinder-backup' + it do + expect(chef_run).to upgrade_package %w(python3-cinder cinder-backup) end it 'starts cinder backup' do diff --git a/spec/cinder_common-redhat_spec.rb b/spec/cinder_common-redhat_spec.rb index 58ffbd1..8dae0a9 100644 --- a/spec/cinder_common-redhat_spec.rb +++ b/spec/cinder_common-redhat_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index a85d4d5..06d9d90 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -1,6 +1,6 @@ # encoding: utf-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' @@ -36,7 +36,7 @@ describe 'openstack-block-storage::cinder-common' do expect(chef_run).to create_directory(dir.name).with( owner: 'cinder', group: 'cinder', - mode: 0o0750 + mode: '750' ) end end @@ -46,9 +46,12 @@ describe 'openstack-block-storage::cinder-common' do it 'should create the cinder.conf template' do expect(chef_run).to create_template(file.name).with( + source: 'openstack-service.conf.erb', + cookbook: 'openstack-common', owner: 'cinder', group: 'cinder', - mode: 0o0640 + mode: '640', + sensitive: true ) end @@ -168,7 +171,7 @@ describe 'openstack-block-storage::cinder-common' do expect(chef_run).to create_directory(dir.name).with( user: 'cinder', group: 'cinder', - mode: 0o0755 + mode: '755' ) end end @@ -180,7 +183,7 @@ describe 'openstack-block-storage::cinder-common' do expect(chef_run).to create_template(file.name).with( user: 'root', group: 'root', - mode: 0o644 + mode: '644' ) end diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index f6bb447..b11cf92 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' diff --git a/spec/scheduler-redhat_spec.rb b/spec/scheduler-redhat_spec.rb index 321bf2f..1e577b6 100644 --- a/spec/scheduler-redhat_spec.rb +++ b/spec/scheduler-redhat_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' diff --git a/spec/scheduler_spec.rb b/spec/scheduler_spec.rb index 4a7a6d0..bff2eb7 100644 --- a/spec/scheduler_spec.rb +++ b/spec/scheduler_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' @@ -14,8 +14,8 @@ describe 'openstack-block-storage::scheduler' do include_examples 'common-logging' include_examples 'creates_cinder_conf', 'service[cinder-scheduler]', 'cinder', 'cinder' - it 'upgrades cinder scheduler package' do - expect(chef_run).to upgrade_package 'cinder-scheduler' + it do + expect(chef_run).to upgrade_package %w(python3-cinder cinder-scheduler) end it 'starts cinder scheduler' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 952eb0d..4df81e0 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require 'chefspec' 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( user: user, group: group, - mode: 0o640 + mode: '640' ) end diff --git a/spec/volume-redhat_spec.rb b/spec/volume-redhat_spec.rb index b4214cc..fb7747b 100644 --- a/spec/volume-redhat_spec.rb +++ b/spec/volume-redhat_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' @@ -20,8 +20,8 @@ describe 'openstack-block-storage::volume' do expect(chef_run).to upgrade_package('qemu-img-ev') end - it 'upgrades cinder iscsi package' do - expect(chef_run).to upgrade_package('targetcli') + it do + expect(chef_run).to upgrade_package %w(targetcli dbus-python) end it 'starts cinder volume' do diff --git a/spec/volume_spec.rb b/spec/volume_spec.rb index 864f3cb..029850e 100644 --- a/spec/volume_spec.rb +++ b/spec/volume_spec.rb @@ -1,6 +1,6 @@ # encoding: UTF-8 # -# Cookbook Name:: openstack-block-storage +# Cookbook:: openstack-block-storage require_relative 'spec_helper' @@ -14,16 +14,8 @@ describe 'openstack-block-storage::volume' do include_examples 'common-logging' include_examples 'creates_cinder_conf', 'service[cinder-volume]', 'cinder', 'cinder' - it 'upgrades cinder volume packages' do - expect(chef_run).to upgrade_package 'cinder-volume' - 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' + it do + expect(chef_run).to upgrade_package %w(python3-cinder cinder-volume qemu-utils thin-provisioning-tools) end it 'starts cinder volume' do