Browse Source

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
Samuel Cassiba 1 year ago
parent
commit
fe6a3d552c

+ 6
- 1
.rubocop_todo.yml View File

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

+ 0
- 14
Gemfile View File

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

+ 2
- 2
attributes/default.rb View File

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

+ 15
- 12
metadata.rb View File

@@ -1,11 +1,9 @@
1
-name 'openstack-ops-database'
2
-maintainer 'openstack-chef'
1
+name             'openstack-ops-database'
2
+maintainer       'openstack-chef'
3 3
 maintainer_email 'openstack-dev@lists.openstack.org'
4
-issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url)
5
-source_url 'https://github.com/openstack/cookbook-openstack-ops-database' if respond_to?(:source_url)
6
-license 'Apache 2.0'
7
-description 'Provides the shared database configuration for Chef for OpenStack.'
8
-version '15.0.0'
4
+license          'Apache 2.0'
5
+description      'Provides the shared database configuration for Chef for OpenStack.'
6
+version          '15.0.0'
9 7
 
10 8
 recipe 'client', 'Installs client packages for the database used by the deployment.'
11 9
 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
21 19
   supports os
22 20
 end
23 21
 
24
-depends 'mariadb', '~> 0.3.3'
25
-depends 'percona', '~> 0.16.1'
22
+depends 'openstack-common', '>= 15.0.0'
23
+
24
+depends 'database', '~> 6.1'
25
+depends 'mariadb', '~> 1.5'
26 26
 depends 'mysql', '~> 8.2'
27
-depends 'mysql2_chef_gem', '~> 1.1'
27
+depends 'mysql2_chef_gem', '~> 2.0'
28
+depends 'percona', '~> 0.16.1'
28 29
 depends 'postgresql', '~> 5.1'
29
-depends 'database', '~> 6.1'
30
-depends 'openstack-common', '>= 15.0.0'
30
+
31
+issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url)
32
+source_url 'https://github.com/openstack/cookbook-openstack-ops-database' if respond_to?(:source_url)
33
+chef_version '>= 12.5' if respond_to?(:chef_version)

+ 2
- 3
recipes/mariadb-client.rb View File

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

+ 1
- 1
recipes/mysql-client.rb View File

@@ -34,7 +34,7 @@ when 'rhel'
34 34
 end
35 35
 
36 36
 mysql2_chef_gem 'default' do
37
-  gem_version '0.4.4'
37
+  gem_version '0.4.5'
38 38
   action :install
39 39
 end
40 40
 

+ 0
- 5
spec/mariadb-client_spec.rb View File

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

+ 2
- 1
spec/postgresql-server_spec.rb View File

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

+ 2
- 1
spec/server_spec.rb View File

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

Loading…
Cancel
Save