Initial orchestration Pike updates

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

Change-Id: Icc3eca4b2d17a6d1ef66c1c7e75513de0ee3cac9
This commit is contained in:
Samuel Cassiba 2017-08-23 22:38:10 -04:00
parent 1a46445152
commit 032dd3c51a
8 changed files with 26 additions and 48 deletions

View File

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

View File

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

View File

@ -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"

View File

@ -44,8 +44,8 @@ default['openstack']['bind_service']['all']['orchestration-api-cloudwatch']['por
# 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']['orchestration']['custom_template_banner'] = '
# This file was autogenerated by Chef
# Do not edit, changes will be overwritten
# This file is automatically generated by Chef
# Any changes will be overwritten
'
default['openstack']['orchestration']['syslog']['use']
@ -78,7 +78,7 @@ when 'rhel'
'heat_engine_packages' => ['openstack-heat-engine'],
'heat_engine_service' => 'openstack-heat-engine',
'heat_api_process_name' => 'heat-api',
'package_overrides' => ''
'package_overrides' => '',
}
when 'debian'
default['openstack']['orchestration']['user'] = 'heat'
@ -93,6 +93,6 @@ when 'debian'
'heat_api_cloudwatch_service' => 'heat-api-cloudwatch',
'heat_engine_packages' => ['heat-engine'],
'heat_engine_service' => 'heat-engine',
'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

View File

@ -19,7 +19,7 @@
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end

View File

@ -20,7 +20,7 @@
require 'uri'
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end
@ -56,7 +56,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,
}
# Register Orchestration Service

View File

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

View File

@ -10,17 +10,17 @@ LOG_LEVEL = :fatal
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
log_level: ::LOG_LEVEL
log_level: ::LOG_LEVEL,
}.freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '16.04',
log_level: ::LOG_LEVEL
log_level: ::LOG_LEVEL,
}.freeze
SUSE_OPTS = {
platform: 'suse',
version: '11.3',
log_level: ::LOG_LEVEL
log_level: ::LOG_LEVEL,
}.freeze
shared_context 'orchestration_stubs' do
@ -130,7 +130,7 @@ shared_examples 'expects to create heat conf' do
%r{^heat_waitcondition_server_url = http://127.0.0.1:8000/v1/waitcondition$},
%r{^heat_watch_server_url = http://127.0.0.1:8003$},
%r{^log_dir = /var/log/heat$},
/^region_name_for_services = RegionOne$/
/^region_name_for_services = RegionOne$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
end
@ -138,7 +138,7 @@ shared_examples 'expects to create heat conf' do
it 'has oslo_messaging_notifications conf values' do
[
/^driver = heat.openstack.common.notifier.rpc_notifier$/
/^driver = heat.openstack.common.notifier.rpc_notifier$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_notifications', line)
end
@ -147,7 +147,7 @@ shared_examples 'expects to create heat conf' do
it 'has heat_api binding' do
[
/^bind_host = 127.0.0.1$/,
/^bind_port = 8004$/
/^bind_port = 8004$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('heat_api', line)
end
@ -156,7 +156,7 @@ shared_examples 'expects to create heat conf' do
it 'has heat_api_cfn binding' do
[
/^bind_host = 127.0.0.1$/,
/^bind_port = 8000$/
/^bind_port = 8000$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('heat_api_cfn', line)
end
@ -165,7 +165,7 @@ shared_examples 'expects to create heat conf' do
it 'has heat_api_cloudwatch binding' do
[
/^bind_host = 127.0.0.1$/,
/^bind_port = 8003$/
/^bind_port = 8003$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('heat_api_cloudwatch', line)
end
@ -193,7 +193,7 @@ shared_examples 'expects to create heat conf' do
describe 'has oslo_messaging_rabbit values' do
it 'has default rabbit values' 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)
end
@ -209,7 +209,7 @@ shared_examples 'expects to create heat conf' do
/^project_name = service$/,
/^user_domain_name = Default/,
/^project_domain_name = Default/,
/^password = heat-pass$/
/^password = heat-pass$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('keystone_authtoken', line)
end
@ -223,7 +223,7 @@ shared_examples 'expects to create heat conf' do
/^auth_plugin = v3password$/,
/^username = heat$/,
/^password = heat-pass$/,
/^user_domain_name = Default$/
/^user_domain_name = Default$/,
].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('trustee', line)
end