Style and lint fixes for chefdk, deprecated Gemfile

- Style and lint fixes for newer chefdk
- Removed ancient Gemfile
- Rewrote metadata.rb for readability
- Adapted mariadb recipe for newer mysql2_chef_gem

Change-Id: I3112615cec3dd80c63779d164893b4171773856c
Depends-On: I950605f384405b55737af77bc4224f1e18fee8e1
This commit is contained in:
Samuel Cassiba 2017-08-02 01:58:10 -04:00
parent 8f514568cd
commit fe6a3d552c
9 changed files with 31 additions and 41 deletions

View File

@ -1,11 +1,16 @@
# This configuration was generated by # This configuration was generated by
# `rubocop --auto-gen-config` # `rubocop --auto-gen-config`
# on 2017-02-23 16:58:35 +0100 using RuboCop version 0.39.0. # on 2017-08-01 10:49:49 -0400 using RuboCop version 0.47.1.
# The point is for the user to remove these configuration records # The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base. # one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new # Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again. # versions of RuboCop, may require this file to be generated again.
# Offense count: 6
# Configuration parameters: CountComments, ExcludedMethods.
BlockLength:
Max: 62
# Offense count: 5 # Offense count: 5
# Configuration parameters: EnforcedStyle, SupportedStyles. # Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact # SupportedStyles: nested, compact

14
Gemfile
View File

@ -1,14 +0,0 @@
## THIS GEMFILE IS DEPRECATED AND WILL BE REMOVED AFTER THE NEXT RELEASE
## THERE WON'T BE ANY UPDATES TO THIS FILE DURING THIS RELEASE CYCLE
## WE SWITCHED TO CHEFDK AS THE BUNDLE FOR THE NEEDED GEMS
source 'https://rubygems.org'
gem 'chef', '~> 11.18.6'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 3.2.1'
gem 'hashie', '~> 2.0'
gem 'chefspec', '~> 4.0.0'
gem 'rspec', '~> 3.0.0'
gem 'foodcritic', '~> 4.0'
gem 'rubocop', '~> 0.29.1'

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 autogenerated by Chef # This file is autogenerated by Chef.
# Do not edit, changes will be overwritten # Do not edit. Your changes will be overwritten!
' '

View File

@ -1,11 +1,9 @@
name 'openstack-ops-database' name 'openstack-ops-database'
maintainer 'openstack-chef' maintainer 'openstack-chef'
maintainer_email 'openstack-dev@lists.openstack.org' maintainer_email 'openstack-dev@lists.openstack.org'
issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url) license 'Apache 2.0'
source_url 'https://github.com/openstack/cookbook-openstack-ops-database' if respond_to?(:source_url) description 'Provides the shared database configuration for Chef for OpenStack.'
license 'Apache 2.0' version '15.0.0'
description 'Provides the shared database configuration for Chef for OpenStack.'
version '15.0.0'
recipe 'client', 'Installs client packages for the database used by the deployment.' recipe 'client', 'Installs client packages for the database used by the deployment.'
recipe 'server', 'Installs and configures server packages for the database used by the deployment.' recipe 'server', 'Installs and configures server packages for the database used by the deployment.'
@ -21,10 +19,15 @@ recipe 'openstack-db', 'Creates necessary tables, users, and grants for OpenStac
supports os supports os
end end
depends 'mariadb', '~> 0.3.3'
depends 'percona', '~> 0.16.1'
depends 'mysql', '~> 8.2'
depends 'mysql2_chef_gem', '~> 1.1'
depends 'postgresql', '~> 5.1'
depends 'database', '~> 6.1'
depends 'openstack-common', '>= 15.0.0' depends 'openstack-common', '>= 15.0.0'
depends 'database', '~> 6.1'
depends 'mariadb', '~> 1.5'
depends 'mysql', '~> 8.2'
depends 'mysql2_chef_gem', '~> 2.0'
depends 'percona', '~> 0.16.1'
depends 'postgresql', '~> 5.1'
issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url)
source_url 'https://github.com/openstack/cookbook-openstack-ops-database' if respond_to?(:source_url)
chef_version '>= 12.5' if respond_to?(:chef_version)

View File

@ -19,9 +19,8 @@
node.override['mariadb']['install']['prefer_os_package'] = true node.override['mariadb']['install']['prefer_os_package'] = true
include_recipe 'mariadb::client' include_recipe 'mariadb::client'
mysql2_chef_gem 'default' do mysql2_chef_gem_mariadb 'default' do
provider Chef::Provider::Mysql2ChefGem::Mariadb gem_version '0.4.5'
gem_version '0.4.4'
action :install action :install
end end

View File

@ -34,7 +34,7 @@ when 'rhel'
end end
mysql2_chef_gem 'default' do mysql2_chef_gem 'default' do
gem_version '0.4.4' gem_version '0.4.5'
action :install action :install
end end

View File

@ -16,11 +16,6 @@ describe 'openstack-ops-database::mariadb-client' do
expect(chef_run).to include_recipe('mariadb::client') expect(chef_run).to include_recipe('mariadb::client')
end end
it 'install mysql2 gem package' do
expect(chef_run).to install_mysql2_chef_gem('default')
.with(provider: Chef::Provider::Mysql2ChefGem::Mariadb)
end
it 'installs mariadb python client packages' do it 'installs mariadb python client packages' do
expect(chef_run).to install_package('python-mysqldb') expect(chef_run).to install_package('python-mysqldb')
end end

View File

@ -19,7 +19,8 @@ describe 'openstack-ops-database::postgresql-server' do
it 'includes postgresql recipes' do it 'includes postgresql recipes' do
expect(chef_run).to include_recipe( expect(chef_run).to include_recipe(
'openstack-ops-database::postgresql-client') 'openstack-ops-database::postgresql-client'
)
expect(chef_run).to include_recipe('postgresql::server') expect(chef_run).to include_recipe('postgresql::server')
end end
end end

View File

@ -21,7 +21,8 @@ describe 'openstack-ops-database::server' do
node.set['postgresql']['password']['postgres'] = 'postgres_password' node.set['postgresql']['password']['postgres'] = 'postgres_password'
expect(chef_run).to include_recipe( expect(chef_run).to include_recipe(
'openstack-ops-database::postgresql-server') 'openstack-ops-database::postgresql-server'
)
end end
end end
end end