Initial ops-database Pike updates

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

Change-Id: I76bdb4149965ab7b23709762559bd6c71753cc8b
This commit is contained in:
Samuel Cassiba 2017-08-23 21:20:46 -04:00
parent 7d5c0216b1
commit b876cd00e5
11 changed files with 18 additions and 43 deletions

View File

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

View File

@ -1,23 +0,0 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-08-17 14:16:18 +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: 6
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 62
# Offense count: 5
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'recipes/mariadb-server.rb'
- 'recipes/mysql-server.rb'
- 'recipes/openstack-db.rb'
- 'recipes/percona-cluster-server.rb'
- 'recipes/postgresql-server.rb'

View File

@ -1,20 +1,20 @@
task default: ["test"] task default: ["test"]
task :test => [:lint, :style, :unit] task :test => [:syntax, :lint, :unit]
desc "Vendor the cookbooks in the Berksfile" desc "Vendor the cookbooks in the Berksfile"
task :berks_prep do task :berks_prep do
sh %{chef exec berks vendor} sh %{chef exec berks vendor}
end end
desc "Run FoodCritic (lint) tests" desc "Run FoodCritic (syntax) tests"
task :lint do task :syntax do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .} sh %{chef exec foodcritic --exclude spec -f any .}
end end
desc "Run RuboCop (style) tests" desc "Run RuboCop (lint) tests"
task :style do task :lint do
sh %{chef exec rubocop} sh %{chef exec cookstyle}
end end
desc "Run RSpec (unit) tests" desc "Run RSpec (unit) tests"

View File

@ -21,6 +21,6 @@
# Set to some text value if you want templated config files # Set to some text value if you want templated config files
# to contain a custom banner at the top of the written file # to contain a custom banner at the top of the written file
default['openstack']['db']['custom_template_banner'] = ' default['openstack']['db']['custom_template_banner'] = '
# This file is autogenerated by Chef. # This file is automatically generated by Chef
# Do not edit. Your changes will be overwritten! # Any changes will be overwritten
' '

View File

@ -16,7 +16,7 @@
# limitations under the License. # limitations under the License.
# #
class ::Chef::Recipe # rubocop:disable Documentation class ::Chef::Recipe
include ::Openstack include ::Openstack
end end
@ -59,7 +59,7 @@ end
mysql_connection_info = { mysql_connection_info = {
host: 'localhost', host: 'localhost',
username: 'root', username: 'root',
password: super_password password: super_password,
} }
mysql_database 'drop empty and default users' do mysql_database 'drop empty and default users' do

View File

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

View File

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

View File

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

View File

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

View File

@ -21,7 +21,7 @@ describe 'openstack-ops-database::openstack-db' do
'network' => 'neutron', 'network' => 'neutron',
'object-storage' => 'swift', 'object-storage' => 'swift',
'orchestration' => 'heat', 'orchestration' => 'heat',
'telemetry' => 'ceilometer' 'telemetry' => 'ceilometer',
}.each do |service, _project| }.each do |service, _project|
expect(chef_run).to create_openstack_common_database(service) expect(chef_run).to create_openstack_common_database(service)
.with(user: node['openstack']['db'][service]['username'], .with(user: node['openstack']['db'][service]['username'],

View File

@ -8,12 +8,12 @@ LOG_LEVEL = :fatal
REDHAT_OPTS = { REDHAT_OPTS = {
platform: 'redhat', platform: 'redhat',
version: '7.1', version: '7.1',
log_level: ::LOG_LEVEL log_level: ::LOG_LEVEL,
}.freeze }.freeze
UBUNTU_OPTS = { UBUNTU_OPTS = {
platform: 'ubuntu', platform: 'ubuntu',
version: '16.04', version: '16.04',
log_level: ::LOG_LEVEL log_level: ::LOG_LEVEL,
}.freeze }.freeze
shared_context 'database-stubs' do shared_context 'database-stubs' do