Browse Source

Initial orchestration Pike updates

- Switched default linter to cookstyle
- Renamed rake tasks to better conform with Chef conventions
- Normalized template banner

Change-Id: Icc3eca4b2d17a6d1ef66c1c7e75513de0ee3cac9
changes/87/496987/3
Samuel Cassiba 1 year ago
parent
commit
032dd3c51a

+ 0
- 2
.rubocop.yml View File

@@ -1,5 +1,3 @@
1
-inherit_from: .rubocop_todo.yml
2
-
3 1
 AllCops:
4 2
   Include:
5 3
     - metadata.rb

+ 0
- 20
.rubocop_todo.yml View File

@@ -1,20 +0,0 @@
1
-# This configuration was generated by
2
-# `rubocop --auto-gen-config`
3
-# on 2017-08-18 10:09:13 +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: 7
10
-# Configuration parameters: CountComments, ExcludedMethods.
11
-Metrics/BlockLength:
12
-  Max: 109
13
-
14
-# Offense count: 2
15
-# Configuration parameters: EnforcedStyle, SupportedStyles.
16
-# SupportedStyles: nested, compact
17
-Style/ClassAndModuleChildren:
18
-  Exclude:
19
-    - 'recipes/common.rb'
20
-    - 'recipes/identity_registration.rb'

+ 7
- 7
Rakefile View File

@@ -1,20 +1,20 @@
1 1
 task default: ["test"]
2 2
 
3
-task :test => [:lint, :style, :unit]
3
+task :test => [:syntax, :lint, :unit]
4 4
 
5 5
 desc "Vendor the cookbooks in the Berksfile"
6 6
 task :berks_prep do
7 7
   sh %{chef exec berks vendor}
8 8
 end
9 9
 
10
-desc "Run FoodCritic (lint) tests"
11
-task :lint do
12
-  sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
10
+desc "Run FoodCritic (syntax) tests"
11
+task :syntax do
12
+  sh %{chef exec foodcritic --exclude spec -f any .}
13 13
 end
14 14
 
15
-desc "Run RuboCop (style) tests"
16
-task :style do
17
-  sh %{chef exec rubocop}
15
+desc "Run RuboCop (lint) tests"
16
+task :lint do
17
+  sh %{chef exec cookstyle}
18 18
 end
19 19
 
20 20
 desc "Run RSpec (unit) tests"

+ 4
- 4
attributes/default.rb View File

@@ -44,8 +44,8 @@ default['openstack']['bind_service']['all']['orchestration-api-cloudwatch']['por
44 44
 # Set to some text value if you want templated config files
45 45
 # to contain a custom banner at the top of the written file
46 46
 default['openstack']['orchestration']['custom_template_banner'] = '
47
-# This file was autogenerated by Chef
48
-# Do not edit, changes will be overwritten
47
+# This file is automatically generated by Chef
48
+# Any changes will be overwritten
49 49
 '
50 50
 
51 51
 default['openstack']['orchestration']['syslog']['use']
@@ -78,7 +78,7 @@ when 'rhel'
78 78
     'heat_engine_packages' => ['openstack-heat-engine'],
79 79
     'heat_engine_service' => 'openstack-heat-engine',
80 80
     'heat_api_process_name' => 'heat-api',
81
-    'package_overrides' => ''
81
+    'package_overrides' => '',
82 82
   }
83 83
 when 'debian'
84 84
   default['openstack']['orchestration']['user'] = 'heat'
@@ -93,6 +93,6 @@ when 'debian'
93 93
     'heat_api_cloudwatch_service' => 'heat-api-cloudwatch',
94 94
     'heat_engine_packages' => ['heat-engine'],
95 95
     'heat_engine_service' => 'heat-engine',
96
-    'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
96
+    'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'",
97 97
   }
98 98
 end

+ 1
- 1
recipes/common.rb View File

@@ -19,7 +19,7 @@
19 19
 # limitations under the License.
20 20
 #
21 21
 
22
-class ::Chef::Recipe # rubocop:disable Documentation
22
+class ::Chef::Recipe
23 23
   include ::Openstack
24 24
 end
25 25
 

+ 2
- 2
recipes/identity_registration.rb View File

@@ -20,7 +20,7 @@
20 20
 
21 21
 require 'uri'
22 22
 
23
-class ::Chef::Recipe # rubocop:disable Documentation
23
+class ::Chef::Recipe
24 24
   include ::Openstack
25 25
 end
26 26
 
@@ -56,7 +56,7 @@ connection_params = {
56 56
   openstack_username:     admin_user,
57 57
   openstack_api_key:      admin_pass,
58 58
   openstack_project_name: admin_project,
59
-  openstack_domain_name:    admin_domain
59
+  openstack_domain_name:    admin_domain,
60 60
 }
61 61
 
62 62
 # Register Orchestration Service

+ 1
- 1
spec/identity_registration_spec.rb View File

@@ -14,7 +14,7 @@ describe 'openstack-orchestration::identity_registration' do
14 14
       openstack_username: 'admin',
15 15
       openstack_api_key: 'admin-pass',
16 16
       openstack_project_name: 'admin',
17
-      openstack_domain_name: 'default'
17
+      openstack_domain_name: 'default',
18 18
     }
19 19
     service_name = 'heat'
20 20
     service_type = 'orchestration'

+ 11
- 11
spec/spec_helper.rb View File

@@ -10,17 +10,17 @@ LOG_LEVEL = :fatal
10 10
 REDHAT_OPTS = {
11 11
   platform: 'redhat',
12 12
   version: '7.1',
13
-  log_level: ::LOG_LEVEL
13
+  log_level: ::LOG_LEVEL,
14 14
 }.freeze
15 15
 UBUNTU_OPTS = {
16 16
   platform: 'ubuntu',
17 17
   version: '16.04',
18
-  log_level: ::LOG_LEVEL
18
+  log_level: ::LOG_LEVEL,
19 19
 }.freeze
20 20
 SUSE_OPTS = {
21 21
   platform: 'suse',
22 22
   version: '11.3',
23
-  log_level: ::LOG_LEVEL
23
+  log_level: ::LOG_LEVEL,
24 24
 }.freeze
25 25
 
26 26
 shared_context 'orchestration_stubs' do
@@ -130,7 +130,7 @@ shared_examples 'expects to create heat conf' do
130 130
           %r{^heat_waitcondition_server_url = http://127.0.0.1:8000/v1/waitcondition$},
131 131
           %r{^heat_watch_server_url = http://127.0.0.1:8003$},
132 132
           %r{^log_dir = /var/log/heat$},
133
-          /^region_name_for_services = RegionOne$/
133
+          /^region_name_for_services = RegionOne$/,
134 134
         ].each do |line|
135 135
           expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
136 136
         end
@@ -138,7 +138,7 @@ shared_examples 'expects to create heat conf' do
138 138
 
139 139
       it 'has oslo_messaging_notifications conf values' do
140 140
         [
141
-          /^driver = heat.openstack.common.notifier.rpc_notifier$/
141
+          /^driver = heat.openstack.common.notifier.rpc_notifier$/,
142 142
         ].each do |line|
143 143
           expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_notifications', line)
144 144
         end
@@ -147,7 +147,7 @@ shared_examples 'expects to create heat conf' do
147 147
       it 'has heat_api binding' do
148 148
         [
149 149
           /^bind_host = 127.0.0.1$/,
150
-          /^bind_port = 8004$/
150
+          /^bind_port = 8004$/,
151 151
         ].each do |line|
152 152
           expect(chef_run).to render_config_file(file.name).with_section_content('heat_api', line)
153 153
         end
@@ -156,7 +156,7 @@ shared_examples 'expects to create heat conf' do
156 156
       it 'has heat_api_cfn binding' do
157 157
         [
158 158
           /^bind_host = 127.0.0.1$/,
159
-          /^bind_port = 8000$/
159
+          /^bind_port = 8000$/,
160 160
         ].each do |line|
161 161
           expect(chef_run).to render_config_file(file.name).with_section_content('heat_api_cfn', line)
162 162
         end
@@ -165,7 +165,7 @@ shared_examples 'expects to create heat conf' do
165 165
       it 'has heat_api_cloudwatch binding' do
166 166
         [
167 167
           /^bind_host = 127.0.0.1$/,
168
-          /^bind_port = 8003$/
168
+          /^bind_port = 8003$/,
169 169
         ].each do |line|
170 170
           expect(chef_run).to render_config_file(file.name).with_section_content('heat_api_cloudwatch', line)
171 171
         end
@@ -193,7 +193,7 @@ shared_examples 'expects to create heat conf' do
193 193
     describe 'has oslo_messaging_rabbit values' do
194 194
       it 'has default rabbit values' do
195 195
         [
196
-          %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$}
196
+          %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
197 197
         ].each do |line|
198 198
           expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
199 199
         end
@@ -209,7 +209,7 @@ shared_examples 'expects to create heat conf' do
209 209
           /^project_name = service$/,
210 210
           /^user_domain_name = Default/,
211 211
           /^project_domain_name = Default/,
212
-          /^password = heat-pass$/
212
+          /^password = heat-pass$/,
213 213
         ].each do |line|
214 214
           expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line)
215 215
         end
@@ -223,7 +223,7 @@ shared_examples 'expects to create heat conf' do
223 223
           /^auth_plugin = v3password$/,
224 224
           /^username = heat$/,
225 225
           /^password = heat-pass$/,
226
-          /^user_domain_name = Default$/
226
+          /^user_domain_name = Default$/,
227 227
         ].each do |line|
228 228
           expect(chef_run).to render_config_file(file.name).with_section_content('trustee', line)
229 229
         end

Loading…
Cancel
Save