summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Cassiba <s@cassiba.com>2017-07-11 06:19:21 -0700
committerSamuel Cassiba <s@cassiba.com>2017-08-02 02:15:54 -0400
commitd2ff4496bbbd52cfeeef05cc4d39217da69d5b23 (patch)
tree05ad0ed2d80c6b7d7648461a0a29bbda26196876
parentae28e7479350682671ae8f57d186cd3d6d9d0394 (diff)
Added systemd unit, style and lint fixes for chefdk
- cinder-group-active is still SysV, but can and will start via systemd if coaxed to do so. - Style and lint fixes for newer chefdk - Removed ancient Gemfile - Rewrote metadata.rb for readability Change-Id: I4c26aea78220eb20fc4e5e964af93414855df5f6
Notes
Notes (review): Code-Review+2: Christoph Albers <c.albers@x-ion.de> Code-Review+1: Tovin Seven <vinhnt@vn.fujitsu.com> Workflow+1: Jan Klare <j.klare@cloudbau.de> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 10 Aug 2017 13:18:23 +0000 Reviewed-on: https://review.openstack.org/482563 Project: openstack/cookbook-openstack-block-storage Branch: refs/heads/master
-rw-r--r--.rubocop_todo.yml10
-rw-r--r--Gemfile15
-rw-r--r--files/default/cinder-group-active.service18
-rw-r--r--metadata.rb20
-rw-r--r--recipes/api.rb2
-rw-r--r--recipes/cinder-common.rb8
-rw-r--r--recipes/volume.rb2
-rw-r--r--recipes/volume_driver_lvm.rb8
-rw-r--r--spec/api_spec.rb3
-rw-r--r--spec/cinder_common_spec.rb8
-rw-r--r--spec/spec_helper.rb2
-rw-r--r--spec/volume_spec.rb2
12 files changed, 55 insertions, 43 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 7401031..1c65a87 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -1,15 +1,15 @@
1# This configuration was generated by 1# This configuration was generated by
2# `rubocop --auto-gen-config` 2# `rubocop --auto-gen-config`
3# on 2017-02-23 16:58:21 +0100 using RuboCop version 0.39.0. 3# on 2017-08-02 02:05:24 -0400 using RuboCop version 0.47.1.
4# The point is for the user to remove these configuration records 4# The point is for the user to remove these configuration records
5# one by one as the offenses are removed from the code base. 5# one by one as the offenses are removed from the code base.
6# Note that changes in the inspected code, or installation of new 6# Note that changes in the inspected code, or installation of new
7# versions of RuboCop, may require this file to be generated again. 7# versions of RuboCop, may require this file to be generated again.
8 8
9# Offense count: 1 9# Offense count: 18
10Lint/ParenthesesAsGroupedExpression: 10# Configuration parameters: CountComments, ExcludedMethods.
11 Exclude: 11Metrics/BlockLength:
12 - 'recipes/identity_registration.rb' 12 Max: 178
13 13
14# Offense count: 4 14# Offense count: 4
15# Configuration parameters: EnforcedStyle, SupportedStyles. 15# Configuration parameters: EnforcedStyle, SupportedStyles.
diff --git a/Gemfile b/Gemfile
deleted file mode 100644
index 0c916ff..0000000
--- a/Gemfile
+++ /dev/null
@@ -1,15 +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# encoding: UTF-8
6source 'https://rubygems.org'
7
8gem 'chef', '~> 11.18.6'
9gem 'json', '<= 1.7.7' # chef 11 dependency
10gem 'berkshelf', '~> 3.2.1'
11gem 'hashie', '~> 2.0'
12gem 'chefspec', '~> 4.0.0'
13gem 'rspec', '~> 3.0.0'
14gem 'foodcritic', '~> 4.0'
15gem 'rubocop', '~> 0.29.1'
diff --git a/files/default/cinder-group-active.service b/files/default/cinder-group-active.service
new file mode 100644
index 0000000..37cc140
--- /dev/null
+++ b/files/default/cinder-group-active.service
@@ -0,0 +1,18 @@
1[Unit]
2SourcePath=/etc/init.d/cinder-group-active
3Description=LSB: cinder volume group active script
4After=remote-fs.target
5After=network-online.target
6After=systemd-journald-dev-log.socket
7Wants=network-online.target
8
9[Service]
10Type=oneshot
11Restart=no
12TimeoutSec=5min
13IgnoreSIGPIPE=no
14KillMode=process
15GuessMainPID=no
16RemainAfterExit=true
17ExecStart=/etc/init.d/cinder-group-active start
18ExecStop=/etc/init.d/cinder-group-active stop
diff --git a/metadata.rb b/metadata.rb
index 2f2b11f..39f4965 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -1,20 +1,22 @@
1# encoding: UTF-8 1name 'openstack-block-storage'
2name 'openstack-block-storage' 2maintainer 'Chef OpenStack'
3maintainer 'openstack-chef'
4maintainer_email 'openstack-dev@lists.openstack.org' 3maintainer_email 'openstack-dev@lists.openstack.org'
5issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url) 4license 'Apache 2.0'
6source_url 'https://github.com/openstack/cookbook-openstack-block-storage' if respond_to?(:source_url) 5description 'The OpenStack Advanced Volume Management service Cinder.'
7license 'Apache 2.0'
8description 'The OpenStack Advanced Volume Management service Cinder.'
9long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 6long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
10version '15.0.0' 7version '15.0.0'
11 8
12%w(ubuntu redhat centos).each do |os| 9%w(ubuntu redhat centos).each do |os|
13 supports os 10 supports os
14end 11end
15 12
16depends 'apt', '~> 5.0'
17depends 'openstack-common', '>= 15.0.0' 13depends 'openstack-common', '>= 15.0.0'
18depends 'openstack-identity', '>= 15.0.0' 14depends 'openstack-identity', '>= 15.0.0'
19depends 'openstack-image', '>= 15.0.0' 15depends 'openstack-image', '>= 15.0.0'
20depends 'openstackclient' 16depends 'openstackclient'
17
18depends 'apt', '~> 5.0'
19
20issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url)
21source_url 'https://github.com/openstack/cookbook-openstack-block-storage' if respond_to?(:source_url)
22chef_version '>= 12.5' if respond_to?(:chef_version)
diff --git a/recipes/api.rb b/recipes/api.rb
index a9a6a8f..726c5ce 100644
--- a/recipes/api.rb
+++ b/recipes/api.rb
@@ -57,6 +57,6 @@ if node['openstack']['block-storage']['policyfile_url']
57 source node['openstack']['block-storage']['policyfile_url'] 57 source node['openstack']['block-storage']['policyfile_url']
58 owner node['openstack']['block-storage']['user'] 58 owner node['openstack']['block-storage']['user']
59 group node['openstack']['block-storage']['group'] 59 group node['openstack']['block-storage']['group']
60 mode 00644 60 mode 0o0644
61 end 61 end
62end 62end
diff --git a/recipes/cinder-common.rb b/recipes/cinder-common.rb
index 15170db..57edc9c 100644
--- a/recipes/cinder-common.rb
+++ b/recipes/cinder-common.rb
@@ -59,7 +59,7 @@ auth_url = identity_admin_endpoint.to_s
59directory '/etc/cinder' do 59directory '/etc/cinder' do
60 group node['openstack']['block-storage']['group'] 60 group node['openstack']['block-storage']['group']
61 owner node['openstack']['block-storage']['user'] 61 owner node['openstack']['block-storage']['user']
62 mode 00750 62 mode 0o0750
63 action :create 63 action :create
64end 64end
65 65
@@ -100,7 +100,7 @@ template '/etc/cinder/cinder.conf' do
100 cookbook 'openstack-common' 100 cookbook 'openstack-common'
101 group node['openstack']['block-storage']['group'] 101 group node['openstack']['block-storage']['group']
102 owner node['openstack']['block-storage']['user'] 102 owner node['openstack']['block-storage']['user']
103 mode 00640 103 mode 0o0640
104 variables( 104 variables(
105 service_config: cinder_conf_options 105 service_config: cinder_conf_options
106 ) 106 )
@@ -119,7 +119,7 @@ directory node['openstack']['block-storage']['conf']['oslo_concurrency']['lock_p
119 group node['openstack']['block-storage']['group'] 119 group node['openstack']['block-storage']['group']
120 owner node['openstack']['block-storage']['user'] 120 owner node['openstack']['block-storage']['user']
121 recursive true 121 recursive true
122 mode 00755 122 mode 0o0755
123end 123end
124 124
125if node['openstack']['block-storage']['use_rootwrap'] 125if node['openstack']['block-storage']['use_rootwrap']
@@ -128,7 +128,7 @@ if node['openstack']['block-storage']['use_rootwrap']
128 cookbook 'openstack-common' 128 cookbook 'openstack-common'
129 owner 'root' 129 owner 'root'
130 group 'root' 130 group 'root'
131 mode 00644 131 mode 0o0644
132 variables( 132 variables(
133 service_config: node['openstack']['block-storage']['rootwrap']['conf'] 133 service_config: node['openstack']['block-storage']['rootwrap']['conf']
134 ) 134 )
diff --git a/recipes/volume.rb b/recipes/volume.rb
index 79f6202..6132f3e 100644
--- a/recipes/volume.rb
+++ b/recipes/volume.rb
@@ -68,7 +68,7 @@ end
68# RHEL7 doesn't need targets.conf file 68# RHEL7 doesn't need targets.conf file
69template '/etc/tgt/targets.conf' do 69template '/etc/tgt/targets.conf' do
70 source 'targets.conf.erb' 70 source 'targets.conf.erb'
71 mode 00600 71 mode 0o0600
72 notifies :restart, 'service[iscsitarget]', :immediately 72 notifies :restart, 'service[iscsitarget]', :immediately
73 not_if { node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7 } 73 not_if { node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7 }
74end 74end
diff --git a/recipes/volume_driver_lvm.rb b/recipes/volume_driver_lvm.rb
index ccb8729..f12afae 100644
--- a/recipes/volume_driver_lvm.rb
+++ b/recipes/volume_driver_lvm.rb
@@ -41,9 +41,15 @@ when 'file'
41 not_if "vgs #{vg_name}" 41 not_if "vgs #{vg_name}"
42 end 42 end
43 43
44 cookbook_file '/etc/systemd/system/cinder-group-active.service' do
45 source 'cinder-group-active.service'
46 mode '0644'
47 action :create_if_missing
48 end
49
44 template '/etc/init.d/cinder-group-active' do 50 template '/etc/init.d/cinder-group-active' do
45 source 'cinder-group-active.erb' 51 source 'cinder-group-active.erb'
46 mode '755' 52 mode '0755'
47 variables( 53 variables(
48 volume_name: vg_name, 54 volume_name: vg_name,
49 volume_file: vg_file 55 volume_file: vg_file
diff --git a/spec/api_spec.rb b/spec/api_spec.rb
index 0233a84..366a2bb 100644
--- a/spec/api_spec.rb
+++ b/spec/api_spec.rb
@@ -45,7 +45,8 @@ describe 'openstack-block-storage::api' do
45 expect(chef_run).to create_remote_file('/etc/cinder/policy.json').with( 45 expect(chef_run).to create_remote_file('/etc/cinder/policy.json').with(
46 user: 'cinder', 46 user: 'cinder',
47 group: 'cinder', 47 group: 'cinder',
48 mode: 00644) 48 mode: 0o0644
49 )
49 end 50 end
50 end 51 end
51 end 52 end
diff --git a/spec/cinder_common_spec.rb b/spec/cinder_common_spec.rb
index d912040..2a11540 100644
--- a/spec/cinder_common_spec.rb
+++ b/spec/cinder_common_spec.rb
@@ -28,7 +28,7 @@ describe 'openstack-block-storage::cinder-common' do
28 expect(chef_run).to create_directory(dir.name).with( 28 expect(chef_run).to create_directory(dir.name).with(
29 owner: 'cinder', 29 owner: 'cinder',
30 group: 'cinder', 30 group: 'cinder',
31 mode: 00750 31 mode: 0o0750
32 ) 32 )
33 end 33 end
34 end 34 end
@@ -46,7 +46,7 @@ describe 'openstack-block-storage::cinder-common' do
46 expect(chef_run).to create_template(file.name).with( 46 expect(chef_run).to create_template(file.name).with(
47 owner: 'cinder', 47 owner: 'cinder',
48 group: 'cinder', 48 group: 'cinder',
49 mode: 00640 49 mode: 0o0640
50 ) 50 )
51 end 51 end
52 52
@@ -185,7 +185,7 @@ describe 'openstack-block-storage::cinder-common' do
185 expect(chef_run).to create_directory(dir.name).with( 185 expect(chef_run).to create_directory(dir.name).with(
186 user: 'cinder', 186 user: 'cinder',
187 group: 'cinder', 187 group: 'cinder',
188 mode: 00755 188 mode: 0o0755
189 ) 189 )
190 end 190 end
191 end 191 end
@@ -197,7 +197,7 @@ describe 'openstack-block-storage::cinder-common' do
197 expect(chef_run).to create_template(file.name).with( 197 expect(chef_run).to create_template(file.name).with(
198 user: 'root', 198 user: 'root',
199 group: 'root', 199 group: 'root',
200 mode: 0644 200 mode: 0o644
201 ) 201 )
202 end 202 end
203 203
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 029cfa8..061067c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -98,7 +98,7 @@ shared_examples 'creates_cinder_conf' do |service, user, group, action = :restar
98 expect(chef_run).to create_template(file.name).with( 98 expect(chef_run).to create_template(file.name).with(
99 user: user, 99 user: user,
100 group: group, 100 group: group,
101 mode: 0640 101 mode: 0o640
102 ) 102 )
103 end 103 end
104 104
diff --git a/spec/volume_spec.rb b/spec/volume_spec.rb
index acf38eb..5c6b3b2 100644
--- a/spec/volume_spec.rb
+++ b/spec/volume_spec.rb
@@ -54,7 +54,7 @@ describe 'openstack-block-storage::volume' do
54 54
55 it 'should create the targets.conf' do 55 it 'should create the targets.conf' do
56 expect(chef_run).to create_template(file.name).with( 56 expect(chef_run).to create_template(file.name).with(
57 mode: 0600 57 mode: 0o600
58 ) 58 )
59 end 59 end
60 60