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:
Include:
- 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 :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

@ -21,6 +21,6 @@
# 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']['db']['custom_template_banner'] = '
# This file is autogenerated by Chef.
# Do not edit. Your changes will be overwritten!
# This file is automatically generated by Chef
# Any changes will be overwritten
'

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -8,12 +8,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: '16.04',
log_level: ::LOG_LEVEL
log_level: ::LOG_LEVEL,
}.freeze
shared_context 'database-stubs' do