diff --git a/Gemfile b/Gemfile index fa26df3..76065e1 100644 --- a/Gemfile +++ b/Gemfile @@ -1,9 +1,9 @@ source 'https://rubygems.org' -gem 'chef', '~> 11.4.4' +gem 'chef', '~> 11.8' gem 'json', '<= 1.7.7' # chef 11 dependency gem 'berkshelf', '~> 2.0.10' -gem 'chefspec', '~> 3.0.2' +gem 'chefspec', '~> 3.1.4' gem 'foodcritic', '~> 3.0.3' gem 'strainer' -gem 'rubocop' +gem 'rubocop', '>= 0.16.0' diff --git a/Gemfile.lock b/Gemfile.lock index e81c4a2..47c4e86 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -37,28 +37,41 @@ GEM celluloid-io (0.14.1) celluloid (>= 0.14.1) nio4r (>= 0.4.5) - chef (11.4.4) - erubis - highline (>= 1.6.9) + chef (11.8.2) + chef-zero (~> 1.6, >= 1.6.2) + diff-lcs (~> 1.2, >= 1.2.4) + erubis (~> 2.7) + highline (~> 1.6, >= 1.6.9) json (>= 1.4.4, <= 1.7.7) - mixlib-authentication (>= 1.3.0) - mixlib-cli (~> 1.3.0) - mixlib-config (>= 1.1.2) - mixlib-log (>= 1.3.0) - mixlib-shellout + mime-types (~> 1.16) + mixlib-authentication (~> 1.3) + mixlib-cli (~> 1.3) + mixlib-config (~> 2.0) + mixlib-log (~> 1.3) + mixlib-shellout (~> 1.2) net-ssh (~> 2.6) net-ssh-multi (~> 1.1.0) - ohai (>= 0.6.0) + ohai (~> 6.0) + pry (~> 0.9) + puma (~> 1.6) rest-client (>= 1.0.4, < 1.7.0) yajl-ruby (~> 1.1) - chefspec (3.0.2) + chef-zero (1.7.2) + hashie (~> 2.0) + json + mixlib-log (~> 1.3) + moneta (< 0.7.0) + rack + chefspec (3.1.4) chef (~> 11.0) fauxhai (~> 2.0) + i18n (>= 0.6.9, < 1.0.0) rspec (~> 2.14) chozo (0.6.1) activesupport (>= 3.2.0) hashie (>= 2.0.2) multi_json (>= 1.3.0) + coderay (1.1.0) diff-lcs (1.2.5) erubis (2.7.0) faraday (0.8.8) @@ -92,14 +105,16 @@ GEM logging (1.8.1) little-plugger (>= 1.1.3) multi_json (>= 1.3.6) - mime-types (2.0) + method_source (0.8.2) + mime-types (1.25.1) minitar (0.5.4) mixlib-authentication (1.3.0) mixlib-log - mixlib-cli (1.3.0) + mixlib-cli (1.4.0) mixlib-config (2.1.0) mixlib-log (1.6.0) mixlib-shellout (1.3.0) + moneta (0.6.0) multi_json (1.8.2) multipart-post (1.2.0) net-http-persistent (2.9) @@ -120,13 +135,19 @@ GEM mixlib-shellout systemu (~> 2.5.2) yajl-ruby - parser (2.0.0) + parser (2.1.2) ast (~> 1.1) slop (~> 3.4, >= 3.4.5) polyglot (0.3.3) powerpack (0.0.9) + pry (0.9.12.4) + coderay (~> 1.0) + method_source (~> 0.8) + slop (~> 3.4) + puma (1.6.3) + rack (~> 1.2) rack (1.5.2) - rainbow (1.1.4) + rainbow (1.99.1) rake (10.1.1) rbzip2 (0.2.0) rest-client (1.6.7) @@ -160,8 +181,8 @@ GEM rspec-expectations (2.14.4) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.4) - rubocop (0.15.0) - parser (~> 2.0) + rubocop (0.16.0) + parser (~> 2.1) powerpack (~> 0.0.6) rainbow (>= 1.1.4) rubyntlm (0.1.1) @@ -205,9 +226,9 @@ PLATFORMS DEPENDENCIES berkshelf (~> 2.0.10) - chef (~> 11.4.4) - chefspec (~> 3.0.2) + chef (~> 11.8) + chefspec (~> 3.1.4) foodcritic (~> 3.0.3) json (<= 1.7.7) - rubocop + rubocop (>= 0.16.0) strainer diff --git a/Strainerfile b/Strainerfile index 77a72ec..6c4f15e 100644 --- a/Strainerfile +++ b/Strainerfile @@ -1,7 +1,8 @@ # Strainerfile +rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/Gemfile rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/attributes/ rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/metadata.rb -rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/Gemfile +rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/recipes/ # rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK # may want to add rubocop check for Berksfile and Gemfile knife test: bundle exec knife cookbook test $COOKBOOK diff --git a/TESTING.md b/TESTING.md index 28409c7..03f1744 100644 --- a/TESTING.md +++ b/TESTING.md @@ -16,7 +16,11 @@ To run the tests: ### Attribute Rules ### -There is a [.rubocop.yml](attributes/.rubocop.yml) specific to `attributes`, with the rationale for ignored styles within the file. +Since there are slight style differences between the coding of attributes, recipes and metadata files there are specific `.rubocop.yml` files for each of: + + [Gemfile and metadata.rb](.rubocop.yml) + [attributes/*.rb](attributes/.rubocop.yml) + [recipes/.rubocop.yml](recipes/.rubocop.yml) ## Knife ## diff --git a/recipes/.rubocop-todo.yml b/recipes/.rubocop-todo.yml new file mode 100644 index 0000000..d5cfdab --- /dev/null +++ b/recipes/.rubocop-todo.yml @@ -0,0 +1,15 @@ +# This configuration was generated by `rubocop --auto-gen-config`. +# The point is for the user to remove these configuration records +# one by one as the offences are removed from the code base. + +CollectionMethods: + Enabled: false + +Documentation: + Enabled: false + +HashSyntax: + Enabled: false + +StringLiterals: + Enabled: false diff --git a/recipes/.rubocop.yml b/recipes/.rubocop.yml new file mode 100644 index 0000000..446ebc4 --- /dev/null +++ b/recipes/.rubocop.yml @@ -0,0 +1,3 @@ +# embedded attributes make for long lines +LineLength: + Enabled: false diff --git a/recipes/api.rb b/recipes/api.rb index 6885a1d..ea91bb3 100644 --- a/recipes/api.rb +++ b/recipes/api.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # # Cookbook Name:: openstack-block-storage # Recipe:: api diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb index 304d7d3..2f97c12 100644 --- a/recipes/cinder-common.rb +++ b/recipes/cinder-common.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -69,4 +70,3 @@ directory node["openstack"]["block-storage"]["lock_path"] do owner node["openstack"]["block-storage"]["user"] mode 00700 end - diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index c968ff2..dbe802e 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # # Cookbook Name:: openstack-block-storage # Recipe:: identity_registration diff --git a/recipes/scheduler.rb b/recipes/scheduler.rb index d1dc675..04dcd31 100644 --- a/recipes/scheduler.rb +++ b/recipes/scheduler.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # # Cookbook Name:: openstack-block-storage # Recipe:: scheduler @@ -42,8 +43,7 @@ end service "cinder-scheduler" do service_name platform_options["cinder_scheduler_service"] supports :status => true, :restart => true - - action [ :enable, :start ] + action [:enable, :start] subscribes :restart, "template[/etc/cinder/cinder.conf]" end @@ -53,7 +53,7 @@ audit_log = node["openstack"]["block-storage"]["cron"]["audit_logfile"] if node["openstack"]["metering"] scheduler_role = node["openstack"]["block-storage"]["scheduler_role"] results = search(:node, "roles:#{scheduler_role}") - cron_node = results.collect{|a| a.name}.sort[0] + cron_node = results.collect { |a| a.name }.sort[0] Chef::Log.debug("Volume audit cron node: #{cron_node}") cron "cinder-volume-usage-audit" do diff --git a/recipes/volume.rb b/recipes/volume.rb index 77874a0..19a85ec 100644 --- a/recipes/volume.rb +++ b/recipes/volume.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # # Cookbook Name:: openstack-block-storage # Recipe:: volume @@ -32,7 +33,6 @@ 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 end @@ -47,7 +47,6 @@ end platform_options["cinder_iscsitarget_packages"].each do |pkg| package pkg do options platform_options["package_overrides"] - action :upgrade end end @@ -83,7 +82,6 @@ when "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver" platform_options["cinder_nfs_packages"].each do |pkg| package pkg do options platform_options["package_overrides"] - action :upgrade end end @@ -107,8 +105,7 @@ when "cinder.volume.drivers.lvm.LVMISCSIDriver" service "cinder-group-active" do service_name "cinder-group-active" supports :status => true, :restart => true - - action [ :enable, :start ] + action [:enable, :start] end template "/etc/init.d/cinder-group-active" do @@ -125,21 +122,18 @@ end service "cinder-volume" do service_name platform_options["cinder_volume_service"] supports :status => true, :restart => true - - action [ :enable, :start ] + action [:enable, :start] subscribes :restart, "template[/etc/cinder/cinder.conf]" end service "iscsitarget" do service_name platform_options["cinder_iscsitarget_service"] supports :status => true, :restart => true - action :enable end template "/etc/tgt/targets.conf" do source "targets.conf.erb" mode 00600 - notifies :restart, "service[iscsitarget]", :immediately end