summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Cassiba <s@cassiba.com>2017-08-23 22:38:32 -0400
committerSamuel Cassiba <s@cassiba.com>2017-08-25 10:14:01 -0400
commitd6736f20ac24fc332cb89a9983eb1af9e6aa261f (patch)
tree1be140fa75194ba9bcd6ca45fefe6c6a3fd4dcb3
parent516a5e7a62b605016b754f196ab3984d009cf9b8 (diff)
Initial telemetry Pike updates
- Switched default linter to cookstyle - Renamed rake tasks to better conform with Chef conventions - Normalized template banner Change-Id: If802d82561619a0b7951422dc0e1e913f2c4c8b4
Notes
Notes (review): Code-Review+2: Jan Klare <j.klare@cloudbau.de> Workflow+1: Christoph Albers <c.albers@x-ion.de> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Mon, 11 Sep 2017 08:42:09 +0000 Reviewed-on: https://review.openstack.org/496988 Project: openstack/cookbook-openstack-telemetry Branch: refs/heads/master
-rw-r--r--.rubocop.yml2
-rw-r--r--.rubocop_todo.yml22
-rw-r--r--Rakefile14
-rw-r--r--attributes/default.rb11
-rw-r--r--recipes/common.rb2
-rw-r--r--recipes/identity_registration.rb4
-rw-r--r--spec/common_spec.rb10
-rw-r--r--spec/gnocchi_configure_spec.rb4
-rw-r--r--spec/identity_registration_spec.rb2
-rw-r--r--spec/spec_helper.rb4
10 files changed, 27 insertions, 48 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index 5e0be9f..253be24 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,5 +1,3 @@
1inherit_from: .rubocop_todo.yml
2
3AllCops: 1AllCops:
4 Include: 2 Include:
5 - metadata.rb 3 - 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 @@
1# This configuration was generated by
2# `rubocop --auto-gen-config`
3# on 2017-08-17 14:16:22 +0200 using RuboCop version 0.47.1.
4# The point is for the user to remove these configuration records
5# one by one as the offenses are removed from the code base.
6# Note that changes in the inspected code, or installation of new
7# versions of RuboCop, may require this file to be generated again.
8
9# Offense count: 20
10# Configuration parameters: CountComments, ExcludedMethods.
11Metrics/BlockLength:
12 Max: 208
13
14# Offense count: 4
15# Configuration parameters: EnforcedStyle, SupportedStyles.
16# SupportedStyles: nested, compact
17Style/ClassAndModuleChildren:
18 Exclude:
19 - 'recipes/api.rb'
20 - 'recipes/common.rb'
21 - 'recipes/gnocchi_configure.rb'
22 - 'recipes/identity_registration.rb'
diff --git a/Rakefile b/Rakefile
index 676e7d4..c9edb13 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,20 +1,20 @@
1task default: ["test"] 1task default: ["test"]
2 2
3task :test => [:lint, :style, :unit] 3task :test => [:syntax, :lint, :unit]
4 4
5desc "Vendor the cookbooks in the Berksfile" 5desc "Vendor the cookbooks in the Berksfile"
6task :berks_prep do 6task :berks_prep do
7 sh %{chef exec berks vendor} 7 sh %{chef exec berks vendor}
8end 8end
9 9
10desc "Run FoodCritic (lint) tests" 10desc "Run FoodCritic (syntax) tests"
11task :lint do 11task :syntax do
12 sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .} 12 sh %{chef exec foodcritic --exclude spec -f any .}
13end 13end
14 14
15desc "Run RuboCop (style) tests" 15desc "Run RuboCop (lint) tests"
16task :style do 16task :lint do
17 sh %{chef exec rubocop} 17 sh %{chef exec cookstyle}
18end 18end
19 19
20desc "Run RSpec (unit) tests" 20desc "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 @@
20# 20#
21# Set to some text value if you want templated config files 21# Set to some text value if you want templated config files
22# to contain a custom banner at the top of the written file 22# to contain a custom banner at the top of the written file
23default['openstack']['telemetry']['custom_template_banner'] = 23default['openstack']['telemetry']['custom_template_banner'] = '
24 '# This file autogenerated by Chef, changes will be overwritten' 24# This file is automatically generated by Chef
25# Any changes will be overwritten
26'
27
25# Set the endpoints for the telemetry services to allow all other cookbooks to 28# Set the endpoints for the telemetry services to allow all other cookbooks to
26# access and use them 29# access and use them
27%w(telemetry telemetry-metric).each do |ts| 30%w(telemetry telemetry-metric).each do |ts|
@@ -103,7 +106,7 @@ when 'rhel'
103 'api_service' => 'openstack-ceilometer-api', 106 'api_service' => 'openstack-ceilometer-api',
104 'collector_packages' => ['openstack-ceilometer-collector'], 107 'collector_packages' => ['openstack-ceilometer-collector'],
105 'collector_service' => 'openstack-ceilometer-collector', 108 'collector_service' => 'openstack-ceilometer-collector',
106 'package_overrides' => '' 109 'package_overrides' => '',
107 } 110 }
108 111
109when 'debian' 112when 'debian'
@@ -124,6 +127,6 @@ when 'debian'
124 'api_service' => 'ceilometer-api', 127 'api_service' => 'ceilometer-api',
125 'collector_packages' => ['ceilometer-collector', 'python-mysqldb'], 128 'collector_packages' => ['ceilometer-collector', 'python-mysqldb'],
126 'collector_service' => 'ceilometer-collector', 129 'collector_service' => 'ceilometer-collector',
127 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'" 130 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'",
128 } 131 }
129end 132end
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 @@
20# limitations under the License. 20# limitations under the License.
21# 21#
22 22
23class ::Chef::Recipe # rubocop:disable Documentation 23class ::Chef::Recipe
24 include ::Openstack 24 include ::Openstack
25end 25end
26 26
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 = {
38 openstack_username: admin_user, 38 openstack_username: admin_user,
39 openstack_api_key: admin_pass, 39 openstack_api_key: admin_pass,
40 openstack_project_name: admin_project, 40 openstack_project_name: admin_project,
41 openstack_domain_name: admin_domain 41 openstack_domain_name: admin_domain,
42} 42}
43 43
44%w(telemetry telemetry-metric).each do |telemetry_service| 44%w(telemetry telemetry-metric).each do |telemetry_service|
@@ -54,7 +54,7 @@ connection_params = {
54 interfaces = { 54 interfaces = {
55 public: { url: public_endpoint(telemetry_service) }, 55 public: { url: public_endpoint(telemetry_service) },
56 internal: { url: internal_endpoint(telemetry_service) }, 56 internal: { url: internal_endpoint(telemetry_service) },
57 admin: { url: admin_endpoint(telemetry_service) } 57 admin: { url: admin_endpoint(telemetry_service) },
58 } 58 }
59 59
60 service_pass = get_password 'service', "openstack-#{telemetry_service}" 60 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
70 /^auth_type = v3password$/, 70 /^auth_type = v3password$/,
71 /^region_name = RegionOne$/, 71 /^region_name = RegionOne$/,
72 %r{auth_url = http://127\.0\.0\.1:5000/v3}, 72 %r{auth_url = http://127\.0\.0\.1:5000/v3},
73 /^password = ceilometer-pass$/ 73 /^password = ceilometer-pass$/,
74 ].each do |line| 74 ].each do |line|
75 expect(chef_run).to render_config_file(file.name) 75 expect(chef_run).to render_config_file(file.name)
76 .with_section_content('keystone_authtoken', line) 76 .with_section_content('keystone_authtoken', line)
@@ -87,7 +87,7 @@ describe 'openstack-telemetry::common' do
87 /^interface = internal$/, 87 /^interface = internal$/,
88 /^region_name = RegionOne$/, 88 /^region_name = RegionOne$/,
89 %r{auth_url = http://127\.0\.0\.1:5000/v3}, 89 %r{auth_url = http://127\.0\.0\.1:5000/v3},
90 /^password = ceilometer-pass$/ 90 /^password = ceilometer-pass$/,
91 ].each do |line| 91 ].each do |line|
92 expect(chef_run).to render_config_file(file.name) 92 expect(chef_run).to render_config_file(file.name)
93 .with_section_content('service_credentials', line) 93 .with_section_content('service_credentials', line)
@@ -97,7 +97,7 @@ describe 'openstack-telemetry::common' do
97 it do 97 it do
98 [ 98 [
99 /^host = 127\.0\.0\.1$/, 99 /^host = 127\.0\.0\.1$/,
100 /^port = 8777$/ 100 /^port = 8777$/,
101 ].each do |line| 101 ].each do |line|
102 expect(chef_run).to render_config_file(file.name) 102 expect(chef_run).to render_config_file(file.name)
103 .with_section_content('api', line) 103 .with_section_content('api', line)
@@ -107,7 +107,7 @@ describe 'openstack-telemetry::common' do
107 it do 107 it do
108 [ 108 [
109 %r{url = http://127\.0\.0\.1:8041}, 109 %r{url = http://127\.0\.0\.1:8041},
110 /^filter_project = service$/ 110 /^filter_project = service$/,
111 ].each do |line| 111 ].each do |line|
112 expect(chef_run).to render_config_file(file.name) 112 expect(chef_run).to render_config_file(file.name)
113 .with_section_content('dispatcher_gnocchi', line) 113 .with_section_content('dispatcher_gnocchi', line)
@@ -116,7 +116,7 @@ describe 'openstack-telemetry::common' do
116 116
117 it do 117 it do
118 [ 118 [
119 %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$} 119 %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
120 ].each do |line| 120 ].each do |line|
121 expect(chef_run).to render_config_file(file.name) 121 expect(chef_run).to render_config_file(file.name)
122 .with_section_content('DEFAULT', line) 122 .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
28 /^auth_type = v3password$/, 28 /^auth_type = v3password$/,
29 /^region_name = RegionOne$/, 29 /^region_name = RegionOne$/,
30 %r{auth_url = http://127\.0\.0\.1:5000/v3}, 30 %r{auth_url = http://127\.0\.0\.1:5000/v3},
31 /^password = gnocchi-pass$/ 31 /^password = gnocchi-pass$/,
32 ].each do |line| 32 ].each do |line|
33 expect(chef_run).to render_config_file(file.name) 33 expect(chef_run).to render_config_file(file.name)
34 .with_section_content('keystone_authtoken', line) 34 .with_section_content('keystone_authtoken', line)
@@ -38,7 +38,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
38 it do 38 it do
39 [ 39 [
40 /^host = 127\.0\.0\.1$/, 40 /^host = 127\.0\.0\.1$/,
41 /^port = 8041$/ 41 /^port = 8041$/,
42 ].each do |line| 42 ].each do |line|
43 expect(chef_run).to render_config_file(file.name) 43 expect(chef_run).to render_config_file(file.name)
44 .with_section_content('api', line) 44 .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
29 openstack_username: 'admin', 29 openstack_username: 'admin',
30 openstack_api_key: 'admin-pass', 30 openstack_api_key: 'admin-pass',
31 openstack_project_name: 'admin', 31 openstack_project_name: 'admin',
32 openstack_domain_name: 'default' 32 openstack_domain_name: 'default',
33 } 33 }
34 service_user = service_name 34 service_user = service_name
35 url = "http://127.0.0.1:#{port}" 35 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
10REDHAT_OPTS = { 10REDHAT_OPTS = {
11 platform: 'redhat', 11 platform: 'redhat',
12 version: '7.1', 12 version: '7.1',
13 log_level: ::LOG_LEVEL 13 log_level: ::LOG_LEVEL,
14}.freeze 14}.freeze
15UBUNTU_OPTS = { 15UBUNTU_OPTS = {
16 platform: 'ubuntu', 16 platform: 'ubuntu',
17 version: '14.04', 17 version: '14.04',
18 log_level: ::LOG_LEVEL 18 log_level: ::LOG_LEVEL,
19}.freeze 19}.freeze
20 20
21shared_context 'telemetry-stubs' do 21shared_context 'telemetry-stubs' do