From 60a38b538db57ce691c2b66d1588be156d9fa948 Mon Sep 17 00:00:00 2001 From: Samuel Cassiba Date: Sun, 20 Aug 2017 10:11:45 -0400 Subject: [PATCH] Initial block-storage Pike updates - Changed the default linter to cookstyle - cinder-group-active was missing a Provides header for the SysV init script - Switched the qemu package to SCL for CentOS to get a newer release - Normalized template banner comment Change-Id: Iec59e0c8e3cb0b83db92a0a9f8db34a40953351f --- .rubocop.yml | 2 -- .rubocop_todo.yml | 22 ---------------------- Rakefile | 14 +++++++------- attributes/default.rb | 10 +++++----- recipes/identity_registration.rb | 4 ++-- spec/cinder_common_spec.rb | 2 +- spec/identity_registration_spec.rb | 2 +- spec/spec_helper.rb | 8 ++++---- spec/volume-redhat_spec.rb | 4 ++-- templates/default/cinder-group-active.erb | 1 + 10 files changed, 23 insertions(+), 46 deletions(-) delete mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index 5e0be9f..253be24 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,5 +1,3 @@ -inherit_from: .rubocop_todo.yml - AllCops: Include: - metadata.rb diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml deleted file mode 100644 index 02f0e90..0000000 --- a/.rubocop_todo.yml +++ /dev/null @@ -1,22 +0,0 @@ -# This configuration was generated by -# `rubocop --auto-gen-config` -# on 2017-08-17 14:15:59 +0200 using RuboCop version 0.47.1. -# 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: 18 -# Configuration parameters: CountComments, ExcludedMethods. -Metrics/BlockLength: - Max: 178 - -# Offense count: 4 -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: nested, compact -Style/ClassAndModuleChildren: - Exclude: - - 'recipes/api.rb' - - 'recipes/cinder-common.rb' - - 'recipes/identity_registration.rb' - - 'recipes/volume.rb' diff --git a/Rakefile b/Rakefile index 676e7d4..c9edb13 100644 --- a/Rakefile +++ b/Rakefile @@ -1,20 +1,20 @@ task default: ["test"] -task :test => [:lint, :style, :unit] +task :test => [:syntax, :lint, :unit] desc "Vendor the cookbooks in the Berksfile" task :berks_prep do sh %{chef exec berks vendor} end -desc "Run FoodCritic (lint) tests" -task :lint do - sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .} +desc "Run FoodCritic (syntax) tests" +task :syntax do + sh %{chef exec foodcritic --exclude spec -f any .} end -desc "Run RuboCop (style) tests" -task :style do - sh %{chef exec rubocop} +desc "Run RuboCop (lint) tests" +task :lint do + sh %{chef exec cookstyle} end desc "Run RSpec (unit) tests" diff --git a/attributes/default.rb b/attributes/default.rb index 1330791..9c0afff 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -30,8 +30,8 @@ default['developer_mode'] = false # we want secure passwords by default # Set to some text value if you want templated config files # to contain a custom banner at the top of the written file default['openstack']['block-storage']['custom_template_banner'] = ' -# This file autogenerated by Chef -# Do not edit, changes will be overwritten +# This file is automatically generated by Chef +# Any changes will be overwritten ' # Specify policy.json remote file to import @@ -79,7 +79,7 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this 'cinder_common_packages' => ['openstack-cinder'], 'cinder_api_packages' => ['openstack-cinder'], 'cinder_api_service' => 'openstack-cinder-api', - 'cinder_volume_packages' => ['qemu-img'], + 'cinder_volume_packages' => ['qemu-img-ev'], 'cinder_volume_service' => 'openstack-cinder-volume', 'cinder_scheduler_packages' => [], 'cinder_scheduler_service' => 'openstack-cinder-scheduler', @@ -93,7 +93,7 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this 'cinder_svc_packages' => ['sysfsutils'], 'cinder_lvm_packages' => ['lvm2'], 'cinder_flashsystem_packages' => ['sysfsutils'], - 'package_overrides' => '' + 'package_overrides' => '', } when 'debian' # operating system user and group names @@ -115,7 +115,7 @@ when 'debian' 'cinder_svc_packages' => ['sysfsutils'], 'cinder_lvm_packages' => ['lvm2'], 'cinder_flashsystem_packages' => ['sysfsutils'], - 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'" + 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'", } end diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index 5eb015d..efae88d 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -32,7 +32,7 @@ auth_url = ::URI.decode identity_admin_endpoint.to_s interfaces = { public: { url: public_endpoint('block-storage') }, internal: { url: internal_endpoint('block-storage') }, - admin: { url: admin_endpoint('block-storage') } + admin: { url: admin_endpoint('block-storage') }, } service_pass = get_password 'service', 'openstack-block-storage' region = node['openstack']['block-storage']['region'] @@ -52,7 +52,7 @@ connection_params = { 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 VolumeV2 Service diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb index 2a11540..fc43260 100644 --- a/spec/cinder_common_spec.rb +++ b/spec/cinder_common_spec.rb @@ -208,7 +208,7 @@ describe 'openstack-block-storage::cinder-common' do %r{^exec_dirs = /sbin,/usr/sbin,/bin,/usr/bin$}, /^use_syslog = false$/, /^syslog_log_facility = syslog$/, - /^syslog_log_level = ERROR$/ + /^syslog_log_level = ERROR$/, ].each do |line| expect(chef_run).to render_file(file.name).with_content(line) end diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index 162f994..f588379 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -17,7 +17,7 @@ describe 'openstack-block-storage::identity_registration' do openstack_username: 'admin', openstack_api_key: 'emc_test_pass', openstack_project_name: 'admin', - openstack_domain_name: 'default' + openstack_domain_name: 'default', } service_name = 'cinderv2' service_type = 'volumev2' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 061067c..eb82788 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,12 +13,12 @@ LOG_LEVEL = :fatal REDHAT_OPTS = { platform: 'redhat', version: '7.1', - log_level: LOG_LEVEL + log_level: LOG_LEVEL, }.freeze UBUNTU_OPTS = { platform: 'ubuntu', version: '16.04', - log_level: LOG_LEVEL + log_level: LOG_LEVEL, }.freeze shared_context 'block-storage-stubs' do @@ -116,7 +116,7 @@ shared_examples 'creates_cinder_conf' do |service, user, group, action = :restar /^project_domain_name = Default/, %r{^auth_uri = http://127.0.0.1:5000/v3$}, %r{^auth_url = http://127.0.0.1:35357/v3$}, - /^password = cinder-pass$/ + /^password = cinder-pass$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('keystone_authtoken', line) @@ -125,7 +125,7 @@ shared_examples 'creates_cinder_conf' do |service, user, group, action = :restar it 'has oslo_messaging_notifications conf values' do [ - /^driver = cinder.openstack.common.notifier.rpc_notifier$/ + /^driver = cinder.openstack.common.notifier.rpc_notifier$/, ].each do |line| expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_notifications', line) end diff --git a/spec/volume-redhat_spec.rb b/spec/volume-redhat_spec.rb index 60a8fff..1830442 100644 --- a/spec/volume-redhat_spec.rb +++ b/spec/volume-redhat_spec.rb @@ -23,8 +23,8 @@ describe 'openstack-block-storage::volume' do expect(chef_run).not_to upgrade_package('MySQL-python') end - it 'upgrades qemu img package' do - expect(chef_run).to upgrade_package('qemu-img') + it 'upgrades qemu-img-ev package' do + expect(chef_run).to upgrade_package('qemu-img-ev') end it 'upgrades cinder iscsi package' do diff --git a/templates/default/cinder-group-active.erb b/templates/default/cinder-group-active.erb index 3a7eebb..098703f 100644 --- a/templates/default/cinder-group-active.erb +++ b/templates/default/cinder-group-active.erb @@ -7,6 +7,7 @@ # chkconfig: - 98 02 # ### BEGIN INIT INFO +# Provides: cinder-group-active # Required-Start: $remote_fs $network $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5