Initial rubocop support for recipes.
Per the mailing list thread, introducing Rubocop as a replacement for Tailor. Assuming Jenkins likes this, more pedantic patches will follow to make Rubocop happy. So far this is just spacing issues and adding UTF-8 headers, but more work will need to be done to remove all of the changes for the .rubocop-todo.yml Change-Id: I590ac5ec03ce6a00dd73027d6798e36105a32af1
This commit is contained in:
		
							
								
								
									
										6
									
								
								Gemfile
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								Gemfile
									
									
									
									
									
								
							| @@ -1,9 +1,9 @@ | |||||||
| source 'https://rubygems.org' | source 'https://rubygems.org' | ||||||
|  |  | ||||||
| gem 'chef', '~> 11.4.4' | gem 'chef', '~> 11.8' | ||||||
| gem 'json', '<= 1.7.7' # chef 11 dependency | gem 'json', '<= 1.7.7' # chef 11 dependency | ||||||
| gem 'berkshelf', '~> 2.0.10' | gem 'berkshelf', '~> 2.0.10' | ||||||
| gem 'chefspec', '~> 3.0.2' | gem 'chefspec', '~> 3.1.4' | ||||||
| gem 'foodcritic', '~> 3.0.3' | gem 'foodcritic', '~> 3.0.3' | ||||||
| gem 'strainer' | gem 'strainer' | ||||||
| gem 'rubocop' | gem 'rubocop', '>= 0.16.0' | ||||||
|   | |||||||
							
								
								
									
										59
									
								
								Gemfile.lock
									
									
									
									
									
								
							
							
						
						
									
										59
									
								
								Gemfile.lock
									
									
									
									
									
								
							| @@ -37,28 +37,41 @@ GEM | |||||||
|     celluloid-io (0.14.1) |     celluloid-io (0.14.1) | ||||||
|       celluloid (>= 0.14.1) |       celluloid (>= 0.14.1) | ||||||
|       nio4r (>= 0.4.5) |       nio4r (>= 0.4.5) | ||||||
|     chef (11.4.4) |     chef (11.8.2) | ||||||
|       erubis |       chef-zero (~> 1.6, >= 1.6.2) | ||||||
|       highline (>= 1.6.9) |       diff-lcs (~> 1.2, >= 1.2.4) | ||||||
|  |       erubis (~> 2.7) | ||||||
|  |       highline (~> 1.6, >= 1.6.9) | ||||||
|       json (>= 1.4.4, <= 1.7.7) |       json (>= 1.4.4, <= 1.7.7) | ||||||
|       mixlib-authentication (>= 1.3.0) |       mime-types (~> 1.16) | ||||||
|       mixlib-cli (~> 1.3.0) |       mixlib-authentication (~> 1.3) | ||||||
|       mixlib-config (>= 1.1.2) |       mixlib-cli (~> 1.3) | ||||||
|       mixlib-log (>= 1.3.0) |       mixlib-config (~> 2.0) | ||||||
|       mixlib-shellout |       mixlib-log (~> 1.3) | ||||||
|  |       mixlib-shellout (~> 1.2) | ||||||
|       net-ssh (~> 2.6) |       net-ssh (~> 2.6) | ||||||
|       net-ssh-multi (~> 1.1.0) |       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) |       rest-client (>= 1.0.4, < 1.7.0) | ||||||
|       yajl-ruby (~> 1.1) |       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) |       chef (~> 11.0) | ||||||
|       fauxhai (~> 2.0) |       fauxhai (~> 2.0) | ||||||
|  |       i18n (>= 0.6.9, < 1.0.0) | ||||||
|       rspec (~> 2.14) |       rspec (~> 2.14) | ||||||
|     chozo (0.6.1) |     chozo (0.6.1) | ||||||
|       activesupport (>= 3.2.0) |       activesupport (>= 3.2.0) | ||||||
|       hashie (>= 2.0.2) |       hashie (>= 2.0.2) | ||||||
|       multi_json (>= 1.3.0) |       multi_json (>= 1.3.0) | ||||||
|  |     coderay (1.1.0) | ||||||
|     diff-lcs (1.2.5) |     diff-lcs (1.2.5) | ||||||
|     erubis (2.7.0) |     erubis (2.7.0) | ||||||
|     faraday (0.8.8) |     faraday (0.8.8) | ||||||
| @@ -92,14 +105,16 @@ GEM | |||||||
|     logging (1.8.1) |     logging (1.8.1) | ||||||
|       little-plugger (>= 1.1.3) |       little-plugger (>= 1.1.3) | ||||||
|       multi_json (>= 1.3.6) |       multi_json (>= 1.3.6) | ||||||
|     mime-types (2.0) |     method_source (0.8.2) | ||||||
|  |     mime-types (1.25.1) | ||||||
|     minitar (0.5.4) |     minitar (0.5.4) | ||||||
|     mixlib-authentication (1.3.0) |     mixlib-authentication (1.3.0) | ||||||
|       mixlib-log |       mixlib-log | ||||||
|     mixlib-cli (1.3.0) |     mixlib-cli (1.4.0) | ||||||
|     mixlib-config (2.1.0) |     mixlib-config (2.1.0) | ||||||
|     mixlib-log (1.6.0) |     mixlib-log (1.6.0) | ||||||
|     mixlib-shellout (1.3.0) |     mixlib-shellout (1.3.0) | ||||||
|  |     moneta (0.6.0) | ||||||
|     multi_json (1.8.2) |     multi_json (1.8.2) | ||||||
|     multipart-post (1.2.0) |     multipart-post (1.2.0) | ||||||
|     net-http-persistent (2.9) |     net-http-persistent (2.9) | ||||||
| @@ -120,13 +135,19 @@ GEM | |||||||
|       mixlib-shellout |       mixlib-shellout | ||||||
|       systemu (~> 2.5.2) |       systemu (~> 2.5.2) | ||||||
|       yajl-ruby |       yajl-ruby | ||||||
|     parser (2.0.0) |     parser (2.1.2) | ||||||
|       ast (~> 1.1) |       ast (~> 1.1) | ||||||
|       slop (~> 3.4, >= 3.4.5) |       slop (~> 3.4, >= 3.4.5) | ||||||
|     polyglot (0.3.3) |     polyglot (0.3.3) | ||||||
|     powerpack (0.0.9) |     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) |     rack (1.5.2) | ||||||
|     rainbow (1.1.4) |     rainbow (1.99.1) | ||||||
|     rake (10.1.1) |     rake (10.1.1) | ||||||
|     rbzip2 (0.2.0) |     rbzip2 (0.2.0) | ||||||
|     rest-client (1.6.7) |     rest-client (1.6.7) | ||||||
| @@ -160,8 +181,8 @@ GEM | |||||||
|     rspec-expectations (2.14.4) |     rspec-expectations (2.14.4) | ||||||
|       diff-lcs (>= 1.1.3, < 2.0) |       diff-lcs (>= 1.1.3, < 2.0) | ||||||
|     rspec-mocks (2.14.4) |     rspec-mocks (2.14.4) | ||||||
|     rubocop (0.15.0) |     rubocop (0.16.0) | ||||||
|       parser (~> 2.0) |       parser (~> 2.1) | ||||||
|       powerpack (~> 0.0.6) |       powerpack (~> 0.0.6) | ||||||
|       rainbow (>= 1.1.4) |       rainbow (>= 1.1.4) | ||||||
|     rubyntlm (0.1.1) |     rubyntlm (0.1.1) | ||||||
| @@ -205,9 +226,9 @@ PLATFORMS | |||||||
|  |  | ||||||
| DEPENDENCIES | DEPENDENCIES | ||||||
|   berkshelf (~> 2.0.10) |   berkshelf (~> 2.0.10) | ||||||
|   chef (~> 11.4.4) |   chef (~> 11.8) | ||||||
|   chefspec (~> 3.0.2) |   chefspec (~> 3.1.4) | ||||||
|   foodcritic (~> 3.0.3) |   foodcritic (~> 3.0.3) | ||||||
|   json (<= 1.7.7) |   json (<= 1.7.7) | ||||||
|   rubocop |   rubocop (>= 0.16.0) | ||||||
|   strainer |   strainer | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| # Strainerfile | # Strainerfile | ||||||
|  | rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/Gemfile | ||||||
| rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/attributes/ | rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/attributes/ | ||||||
| rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/metadata.rb | 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 | # rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK | ||||||
| # may want to add rubocop check for Berksfile and Gemfile | # may want to add rubocop check for Berksfile and Gemfile | ||||||
| knife test: bundle exec knife cookbook test $COOKBOOK | knife test: bundle exec knife cookbook test $COOKBOOK | ||||||
|   | |||||||
| @@ -16,7 +16,11 @@ To run the tests: | |||||||
|  |  | ||||||
| ### Attribute Rules ### | ### 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 ## | ## Knife ## | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								recipes/.rubocop-todo.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								recipes/.rubocop-todo.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -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 | ||||||
							
								
								
									
										3
									
								
								recipes/.rubocop.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								recipes/.rubocop.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,3 @@ | |||||||
|  | # embedded attributes make for long lines | ||||||
|  | LineLength: | ||||||
|  |   Enabled: false | ||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | # encoding: UTF-8 | ||||||
| # | # | ||||||
| # Cookbook Name:: openstack-block-storage | # Cookbook Name:: openstack-block-storage | ||||||
| # Recipe:: api | # Recipe:: api | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | # encoding: UTF-8 | ||||||
| # | # | ||||||
| # 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. | ||||||
| @@ -69,4 +70,3 @@ directory node["openstack"]["block-storage"]["lock_path"] do | |||||||
|   owner  node["openstack"]["block-storage"]["user"] |   owner  node["openstack"]["block-storage"]["user"] | ||||||
|   mode  00700 |   mode  00700 | ||||||
| end | end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | # encoding: UTF-8 | ||||||
| # | # | ||||||
| # Cookbook Name:: openstack-block-storage | # Cookbook Name:: openstack-block-storage | ||||||
| # Recipe:: identity_registration | # Recipe:: identity_registration | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | # encoding: UTF-8 | ||||||
| # | # | ||||||
| # Cookbook Name:: openstack-block-storage | # Cookbook Name:: openstack-block-storage | ||||||
| # Recipe:: scheduler | # Recipe:: scheduler | ||||||
| @@ -42,7 +43,6 @@ end | |||||||
| service "cinder-scheduler" do | service "cinder-scheduler" do | ||||||
|   service_name platform_options["cinder_scheduler_service"] |   service_name platform_options["cinder_scheduler_service"] | ||||||
|   supports :status => true, :restart => true |   supports :status => true, :restart => true | ||||||
|  |  | ||||||
|   action [:enable, :start] |   action [:enable, :start] | ||||||
|   subscribes :restart, "template[/etc/cinder/cinder.conf]" |   subscribes :restart, "template[/etc/cinder/cinder.conf]" | ||||||
| end | end | ||||||
|   | |||||||
| @@ -1,3 +1,4 @@ | |||||||
|  | # encoding: UTF-8 | ||||||
| # | # | ||||||
| # Cookbook Name:: openstack-block-storage | # Cookbook Name:: openstack-block-storage | ||||||
| # Recipe:: volume | # Recipe:: volume | ||||||
| @@ -32,7 +33,6 @@ platform_options = node["openstack"]["block-storage"]["platform"] | |||||||
| platform_options["cinder_volume_packages"].each do |pkg| | platform_options["cinder_volume_packages"].each do |pkg| | ||||||
|   package pkg do |   package pkg do | ||||||
|     options platform_options["package_overrides"] |     options platform_options["package_overrides"] | ||||||
|  |  | ||||||
|     action :upgrade |     action :upgrade | ||||||
|   end |   end | ||||||
| end | end | ||||||
| @@ -47,7 +47,6 @@ end | |||||||
| platform_options["cinder_iscsitarget_packages"].each do |pkg| | platform_options["cinder_iscsitarget_packages"].each do |pkg| | ||||||
|   package pkg do |   package pkg do | ||||||
|     options platform_options["package_overrides"] |     options platform_options["package_overrides"] | ||||||
|  |  | ||||||
|     action :upgrade |     action :upgrade | ||||||
|   end |   end | ||||||
| end | end | ||||||
| @@ -83,7 +82,6 @@ when "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver" | |||||||
|   platform_options["cinder_nfs_packages"].each do |pkg| |   platform_options["cinder_nfs_packages"].each do |pkg| | ||||||
|     package pkg do |     package pkg do | ||||||
|       options platform_options["package_overrides"] |       options platform_options["package_overrides"] | ||||||
|  |  | ||||||
|       action :upgrade |       action :upgrade | ||||||
|     end |     end | ||||||
|   end |   end | ||||||
| @@ -107,7 +105,6 @@ when "cinder.volume.drivers.lvm.LVMISCSIDriver" | |||||||
|     service "cinder-group-active" do |     service "cinder-group-active" do | ||||||
|       service_name "cinder-group-active" |       service_name "cinder-group-active" | ||||||
|       supports :status => true, :restart => true |       supports :status => true, :restart => true | ||||||
|  |  | ||||||
|       action [:enable, :start] |       action [:enable, :start] | ||||||
|     end |     end | ||||||
|  |  | ||||||
| @@ -125,7 +122,6 @@ end | |||||||
| service "cinder-volume" do | service "cinder-volume" do | ||||||
|   service_name platform_options["cinder_volume_service"] |   service_name platform_options["cinder_volume_service"] | ||||||
|   supports :status => true, :restart => true |   supports :status => true, :restart => true | ||||||
|  |  | ||||||
|   action [:enable, :start] |   action [:enable, :start] | ||||||
|   subscribes :restart, "template[/etc/cinder/cinder.conf]" |   subscribes :restart, "template[/etc/cinder/cinder.conf]" | ||||||
| end | end | ||||||
| @@ -133,13 +129,11 @@ end | |||||||
| service "iscsitarget" do | service "iscsitarget" do | ||||||
|   service_name platform_options["cinder_iscsitarget_service"] |   service_name platform_options["cinder_iscsitarget_service"] | ||||||
|   supports :status => true, :restart => true |   supports :status => true, :restart => true | ||||||
|  |  | ||||||
|   action :enable |   action :enable | ||||||
| end | end | ||||||
|  |  | ||||||
| template "/etc/tgt/targets.conf" do | template "/etc/tgt/targets.conf" do | ||||||
|   source "targets.conf.erb" |   source "targets.conf.erb" | ||||||
|   mode   00600 |   mode   00600 | ||||||
|  |  | ||||||
|   notifies :restart, "service[iscsitarget]", :immediately |   notifies :restart, "service[iscsitarget]", :immediately | ||||||
| end | end | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Matt Ray
					Matt Ray