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 7700019..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:16:22 +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: 20 -# Configuration parameters: CountComments, ExcludedMethods. -Metrics/BlockLength: - Max: 208 - -# Offense count: 4 -# Configuration parameters: EnforcedStyle, SupportedStyles. -# SupportedStyles: nested, compact -Style/ClassAndModuleChildren: - Exclude: - - 'recipes/api.rb' - - 'recipes/common.rb' - - 'recipes/gnocchi_configure.rb' - - 'recipes/identity_registration.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 bbd928a..e241248 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,8 +20,11 @@ # # 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']['telemetry']['custom_template_banner'] = - '# This file autogenerated by Chef, changes will be overwritten' +default['openstack']['telemetry']['custom_template_banner'] = ' +# This file is automatically generated by Chef +# Any changes will be overwritten +' + # Set the endpoints for the telemetry services to allow all other cookbooks to # access and use them %w(telemetry telemetry-metric).each do |ts| @@ -103,7 +106,7 @@ when 'rhel' 'api_service' => 'openstack-ceilometer-api', 'collector_packages' => ['openstack-ceilometer-collector'], 'collector_service' => 'openstack-ceilometer-collector', - 'package_overrides' => '' + 'package_overrides' => '', } when 'debian' @@ -124,6 +127,6 @@ when 'debian' 'api_service' => 'ceilometer-api', 'collector_packages' => ['ceilometer-collector', 'python-mysqldb'], 'collector_service' => 'ceilometer-collector', - '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/common.rb b/recipes/common.rb index e77cebb..c721580 100644 --- a/recipes/common.rb +++ b/recipes/common.rb @@ -20,7 +20,7 @@ # limitations under the License. # -class ::Chef::Recipe # rubocop:disable Documentation +class ::Chef::Recipe include ::Openstack end diff --git a/recipes/identity_registration.rb b/recipes/identity_registration.rb index 7aa5b4f..0dd3034 100644 --- a/recipes/identity_registration.rb +++ b/recipes/identity_registration.rb @@ -38,7 +38,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, } %w(telemetry telemetry-metric).each do |telemetry_service| @@ -54,7 +54,7 @@ connection_params = { interfaces = { public: { url: public_endpoint(telemetry_service) }, internal: { url: internal_endpoint(telemetry_service) }, - admin: { url: admin_endpoint(telemetry_service) } + admin: { url: admin_endpoint(telemetry_service) }, } service_pass = get_password 'service', "openstack-#{telemetry_service}" diff --git a/spec/common_spec.rb b/spec/common_spec.rb index 3f5821b..76cfbf3 100644 --- a/spec/common_spec.rb +++ b/spec/common_spec.rb @@ -70,7 +70,7 @@ describe 'openstack-telemetry::common' do /^auth_type = v3password$/, /^region_name = RegionOne$/, %r{auth_url = http://127\.0\.0\.1:5000/v3}, - /^password = ceilometer-pass$/ + /^password = ceilometer-pass$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('keystone_authtoken', line) @@ -87,7 +87,7 @@ describe 'openstack-telemetry::common' do /^interface = internal$/, /^region_name = RegionOne$/, %r{auth_url = http://127\.0\.0\.1:5000/v3}, - /^password = ceilometer-pass$/ + /^password = ceilometer-pass$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('service_credentials', line) @@ -97,7 +97,7 @@ describe 'openstack-telemetry::common' do it do [ /^host = 127\.0\.0\.1$/, - /^port = 8777$/ + /^port = 8777$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('api', line) @@ -107,7 +107,7 @@ describe 'openstack-telemetry::common' do it do [ %r{url = http://127\.0\.0\.1:8041}, - /^filter_project = service$/ + /^filter_project = service$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('dispatcher_gnocchi', line) @@ -116,7 +116,7 @@ describe 'openstack-telemetry::common' do it do [ - %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$} + %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('DEFAULT', line) diff --git a/spec/gnocchi_configure_spec.rb b/spec/gnocchi_configure_spec.rb index ae4198a..5b772d2 100644 --- a/spec/gnocchi_configure_spec.rb +++ b/spec/gnocchi_configure_spec.rb @@ -28,7 +28,7 @@ describe 'openstack-telemetry::gnocchi_configure' do /^auth_type = v3password$/, /^region_name = RegionOne$/, %r{auth_url = http://127\.0\.0\.1:5000/v3}, - /^password = gnocchi-pass$/ + /^password = gnocchi-pass$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('keystone_authtoken', line) @@ -38,7 +38,7 @@ describe 'openstack-telemetry::gnocchi_configure' do it do [ /^host = 127\.0\.0\.1$/, - /^port = 8041$/ + /^port = 8041$/, ].each do |line| expect(chef_run).to render_config_file(file.name) .with_section_content('api', line) diff --git a/spec/identity_registration_spec.rb b/spec/identity_registration_spec.rb index 89ac3ea..d455ffd 100644 --- a/spec/identity_registration_spec.rb +++ b/spec/identity_registration_spec.rb @@ -29,7 +29,7 @@ describe 'openstack-telemetry::identity_registration' do openstack_username: 'admin', openstack_api_key: 'admin-pass', openstack_project_name: 'admin', - openstack_domain_name: 'default' + openstack_domain_name: 'default', } service_user = service_name url = "http://127.0.0.1:#{port}" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index f16b772..5991001 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,12 +10,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: '14.04', - log_level: ::LOG_LEVEL + log_level: ::LOG_LEVEL, }.freeze shared_context 'telemetry-stubs' do