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

Change-Id: Iba9ba7110dfde7635edc6706ecbbafbdbb161002
changes/71/489871/3
Samuel Cassiba 1 year ago
parent
commit
76ee6952af
9 changed files with 41 additions and 47 deletions
  1. 6
    1
      .rubocop_todo.yml
  2. 0
    14
      Gemfile
  3. 10
    7
      metadata.rb
  4. 2
    2
      recipes/api.rb
  5. 3
    3
      recipes/common.rb
  6. 6
    6
      recipes/gnocchi_configure.rb
  7. 2
    2
      spec/api_spec.rb
  8. 3
    3
      spec/common_spec.rb
  9. 9
    9
      spec/gnocchi_configure_spec.rb

+ 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:38 +0100 using RuboCop version 0.39.0.
3
+# on 2017-08-02 02:00:35 -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: 20
10
+# Configuration parameters: CountComments, ExcludedMethods.
11
+Metrics/BlockLength:
12
+  Max: 208
13
+
9 14
 # Offense count: 4
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'

+ 10
- 7
metadata.rb View File

@@ -1,12 +1,10 @@
1
-name 'openstack-telemetry'
2
-maintainer 'openstack-chef'
1
+name             'openstack-telemetry'
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-telemetry' if respond_to?(:source_url)
6
-license 'Apache 2.0'
7
-description 'The OpenStack Metering service Ceilometer.'
4
+license          'Apache 2.0'
5
+description      'The OpenStack Metering service Ceilometer.'
8 6
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
9
-version '15.0.0'
7
+version          '15.0.0'
10 8
 
11 9
 recipe 'openstack-telemetry::agent-central', 'Installs agent central service.'
12 10
 recipe 'openstack-telemetry::agent-compute', 'Installs agent compute service.'
@@ -26,4 +24,9 @@ end
26 24
 depends 'openstack-common', '>= 15.0.0'
27 25
 depends 'openstack-identity', '>= 15.0.0'
28 26
 depends 'openstackclient'
27
+
29 28
 depends 'apache2', '~> 3.2'
29
+
30
+issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url)
31
+source_url 'https://github.com/openstack/cookbook-openstack-telemetry' if respond_to?(:source_url)
32
+chef_version '>= 12.5' if respond_to?(:chef_version)

+ 2
- 2
recipes/api.rb View File

@@ -65,7 +65,7 @@ ceilometer_apache_dir = "#{node['apache']['docroot_dir']}/ceilometer"
65 65
 directory ceilometer_apache_dir do
66 66
   owner 'root'
67 67
   group 'root'
68
-  mode 00755
68
+  mode 0o0755
69 69
 end
70 70
 
71 71
 ceilometer_server_entry = "#{ceilometer_apache_dir}/app"
@@ -75,7 +75,7 @@ file ceilometer_server_entry do
75 75
   content lazy { IO.read(platform['ceilometer-api_wsgi_file']) }
76 76
   owner 'root'
77 77
   group 'root'
78
-  mode 00755
78
+  mode 0o0755
79 79
 end
80 80
 
81 81
 web_app 'ceilometer-api' do

+ 3
- 3
recipes/common.rb View File

@@ -82,14 +82,14 @@ end
82 82
 directory node['openstack']['telemetry']['conf_dir'] do
83 83
   owner node['openstack']['telemetry']['user']
84 84
   group node['openstack']['telemetry']['group']
85
-  mode 00750
85
+  mode 0o0750
86 86
   action :create
87 87
 end
88 88
 
89 89
 directory "#{node['apache']['run_dir']}/ceilometer" do
90 90
   owner node['openstack']['telemetry']['user']
91 91
   group node['openstack']['telemetry']['group']
92
-  mode 00750
92
+  mode 0o0750
93 93
   recursive true
94 94
   action :create
95 95
 end
@@ -102,7 +102,7 @@ template node['openstack']['telemetry']['conf_file'] do
102 102
   cookbook 'openstack-common'
103 103
   owner node['openstack']['telemetry']['user']
104 104
   group node['openstack']['telemetry']['group']
105
-  mode 00640
105
+  mode 0o0640
106 106
   variables(
107 107
     service_config: ceilometer_conf_options
108 108
   )

+ 6
- 6
recipes/gnocchi_configure.rb View File

@@ -54,7 +54,7 @@ template node['openstack']['telemetry-metric']['conf_file'] do
54 54
   cookbook 'openstack-common'
55 55
   owner node['openstack']['telemetry-metric']['user']
56 56
   group node['openstack']['telemetry-metric']['group']
57
-  mode 00640
57
+  mode 0o0640
58 58
   variables(
59 59
     service_config: gnocchi_conf_options
60 60
   )
@@ -66,7 +66,7 @@ cookbook_file File.join(node['openstack']['telemetry']['conf_dir'], 'gnocchi_res
66 66
   source 'gnocchi_resources.yaml'
67 67
   owner node['openstack']['telemetry']['user']
68 68
   group node['openstack']['telemetry']['group']
69
-  mode 00640
69
+  mode 0o0640
70 70
 end
71 71
 
72 72
 # drop api-paste.ini to gnocchi folder (default ini will not use keystone auth)
@@ -74,7 +74,7 @@ cookbook_file File.join(node['openstack']['telemetry-metric']['conf_dir'], 'api-
74 74
   source 'api-paste.ini'
75 75
   owner node['openstack']['telemetry-metric']['user']
76 76
   group node['openstack']['telemetry-metric']['group']
77
-  mode 00640
77
+  mode 0o0640
78 78
 end
79 79
 
80 80
 if node['openstack']['telemetry-metric']['conf']['storage']['driver'] == 'file'
@@ -87,7 +87,7 @@ if node['openstack']['telemetry-metric']['conf']['storage']['driver'] == 'file'
87 87
       owner node['openstack']['telemetry-metric']['user']
88 88
       group node['openstack']['telemetry-metric']['group']
89 89
       recursive true
90
-      mode 00750
90
+      mode 0o0750
91 91
     end
92 92
   end
93 93
 end
@@ -119,7 +119,7 @@ gnocchi_apache_dir = "#{node['apache']['docroot_dir']}/gnocchi"
119 119
 directory gnocchi_apache_dir do
120 120
   owner 'root'
121 121
   group 'root'
122
-  mode 00755
122
+  mode 0o0755
123 123
 end
124 124
 
125 125
 gnocchi_server_entry = "#{gnocchi_apache_dir}/app"
@@ -129,7 +129,7 @@ file gnocchi_server_entry do
129 129
   content lazy { IO.read(platform['gnocchi-api_wsgi_file']) }
130 130
   owner 'root'
131 131
   group 'root'
132
-  mode 00755
132
+  mode 0o0755
133 133
 end
134 134
 
135 135
 web_app 'gnocchi-api' do

+ 2
- 2
spec/api_spec.rb View File

@@ -35,7 +35,7 @@ describe 'openstack-telemetry::api' do
35 35
       expect(chef_run).to create_directory('/var/www/html/ceilometer').with(
36 36
         user: 'root',
37 37
         group: 'root',
38
-        mode: 00755
38
+        mode: 0o0755
39 39
       )
40 40
     end
41 41
 
@@ -43,7 +43,7 @@ describe 'openstack-telemetry::api' do
43 43
       expect(chef_run).to create_file('/var/www/html/ceilometer/app').with(
44 44
         user: 'root',
45 45
         group: 'root',
46
-        mode: 00755
46
+        mode: 0o0755
47 47
       )
48 48
     end
49 49
 

+ 3
- 3
spec/common_spec.rb View File

@@ -40,7 +40,7 @@ describe 'openstack-telemetry::common' do
40 40
         expect(chef_run).to create_directory(dir.name).with(
41 41
           user: 'ceilometer',
42 42
           group: 'ceilometer',
43
-          mode: 0750
43
+          mode: 0o750
44 44
         )
45 45
       end
46 46
     end
@@ -52,7 +52,7 @@ describe 'openstack-telemetry::common' do
52 52
         expect(chef_run).to create_template(file.name).with(
53 53
           user: 'ceilometer',
54 54
           group: 'ceilometer',
55
-          mode: 0640
55
+          mode: 0o640
56 56
         )
57 57
       end
58 58
 
@@ -127,7 +127,7 @@ describe 'openstack-telemetry::common' do
127 127
         expect(chef_run).to render_config_file(file.name)
128 128
           .with_section_content(
129 129
             'database',
130
-            %r{^connection = mysql://ceilometer:ceilometer-dbpass@127\.0\.0\.1:3306/ceilometer\?charset=utf8$}
130
+            %(connection = mysql+pymysql://ceilometer:ceilometer-dbpass@127.0.0.1:3306/ceilometer?charset=utf8)
131 131
           )
132 132
       end
133 133
     end

+ 9
- 9
spec/gnocchi_configure_spec.rb View File

@@ -15,7 +15,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
15 15
         expect(chef_run).to create_template(file.name).with(
16 16
           user: 'gnocchi',
17 17
           group: 'gnocchi',
18
-          mode: 0640
18
+          mode: 0o640
19 19
         )
20 20
       end
21 21
 
@@ -49,7 +49,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
49 49
         expect(chef_run).to render_config_file(file.name)
50 50
           .with_section_content(
51 51
             'database',
52
-            %r{^connection = mysql://gnocchi:gnocchi-dbpass@127\.0\.0\.1:3306/gnocchi\?charset=utf8$}
52
+            %(connection = mysql+pymysql://gnocchi:gnocchi-dbpass@127.0.0.1:3306/gnocchi?charset=utf8)
53 53
           )
54 54
       end
55 55
 
@@ -57,7 +57,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
57 57
         expect(chef_run).to render_config_file(file.name)
58 58
           .with_section_content(
59 59
             'indexer',
60
-            %r{^url = mysql://gnocchi:gnocchi-dbpass@127\.0\.0\.1:3306/gnocchi\?charset=utf8$}
60
+            %(url = mysql+pymysql://gnocchi:gnocchi-dbpass@127.0.0.1:3306/gnocchi?charset=utf8)
61 61
           )
62 62
       end
63 63
     end
@@ -68,7 +68,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
68 68
           source: 'gnocchi_resources.yaml',
69 69
           owner: 'ceilometer',
70 70
           group: 'ceilometer',
71
-          mode: 00640
71
+          mode: 0o0640
72 72
         )
73 73
     end
74 74
 
@@ -78,7 +78,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
78 78
           source: 'api-paste.ini',
79 79
           owner: 'gnocchi',
80 80
           group: 'gnocchi',
81
-          mode: 00640
81
+          mode: 0o0640
82 82
         )
83 83
     end
84 84
 
@@ -90,7 +90,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
90 90
               .with(
91 91
                 user: 'gnocchi',
92 92
                 group: 'gnocchi',
93
-                mode: 0750
93
+                mode: 0o750
94 94
               )
95 95
           end
96 96
         end
@@ -103,7 +103,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
103 103
               .with(
104 104
                 user: 'gnocchi',
105 105
                 group: 'gnocchi',
106
-                mode: 0750
106
+                mode: 0o750
107 107
               )
108 108
           end
109 109
         end
@@ -143,7 +143,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
143 143
       expect(chef_run).to create_directory('/var/www/html/gnocchi').with(
144 144
         user: 'root',
145 145
         group: 'root',
146
-        mode: 00755
146
+        mode: 0o0755
147 147
       )
148 148
     end
149 149
 
@@ -151,7 +151,7 @@ describe 'openstack-telemetry::gnocchi_configure' do
151 151
       expect(chef_run).to create_file('/var/www/html/gnocchi/app').with(
152 152
         user: 'root',
153 153
         group: 'root',
154
-        mode: 00755
154
+        mode: 0o0755
155 155
       )
156 156
     end
157 157
 

Loading…
Cancel
Save