Browse Source

Unified Rubocop cleanups under single file.

Consolidate all the .rubocop.yml into a single file, finished out cleanups for
all the Ruby files.

Change-Id: I92d5983724d5d0185cd25bea6a0f46657a6c05d4
Addresses: blueprint rubocop-for-block-storage
Matt Ray 5 years ago
parent
commit
60e37c5eb0

+ 11
- 3
.rubocop.yml View File

@@ -1,7 +1,15 @@
1
-# UTF-8 headers not generally in these files
2
-Encoding:
3
-  Enabled: false
1
+AllCops:
2
+  Includes:
3
+    - metadata.rb
4
+    - Gemfile
5
+    - attributes/**
6
+    - recipes/**
7
+    - spec/**
4 8
 
5 9
 # ignore long lines
6 10
 LineLength:
7 11
   Enabled: false
12
+
13
+# Allow small arrays before forcing  %w or %W
14
+WordArray:
15
+  MinSize: 3

+ 0
- 25
.tailor View File

@@ -1,25 +0,0 @@
1
-Tailor.config do |config|
2
-  config.formatters "text"
3
-  config.file_set '**/*.rb' do |style|
4
-    style.max_line_length 80, level: :off
5
-    style.allow_camel_case_methods false, level: :error
6
-    style.allow_hard_tabs false, level: :error
7
-    style.allow_screaming_snake_case_classes false, level: :error
8
-    style.allow_trailing_line_spaces false, level: :error
9
-    style.allow_invalid_ruby false, level: :warn
10
-    style.indentation_spaces 2, level: :error
11
-    style.max_code_lines_in_class 300, level: :error
12
-    style.max_code_lines_in_method 30, level: :error
13
-    style.spaces_after_comma 1, level: :error
14
-    style.spaces_after_lbrace 1, level: :error
15
-    style.spaces_after_lbracket 0, level: :error
16
-    style.spaces_after_lparen 0, level: :error
17
-    style.spaces_before_comma 0, level: :error
18
-    style.spaces_before_lbrace 1, level: :error
19
-    style.spaces_before_rbrace 1, level: :error
20
-    style.spaces_before_rbracket 0, level: :error
21
-    style.spaces_before_rparen 0, level: :error
22
-    style.spaces_in_empty_braces 0, level: :error
23
-    style.trailing_newlines 1, level: :error
24
-  end
25
-end

+ 8
- 8
Berksfile.lock View File

@@ -6,20 +6,20 @@
6 6
     "openstack-image": {
7 7
       "locked_version": "8.0.0",
8 8
       "git": "git://github.com/stackforge/cookbook-openstack-image.git",
9
-      "ref": "900c9eef120e22368bb27062473ae549643e9594"
9
+      "ref": "2be8d1e01789f4e7a3fc7b6f8a2f43df3fae59c5"
10 10
     },
11 11
     "openstack-identity": {
12 12
       "locked_version": "8.0.0",
13 13
       "git": "git://github.com/stackforge/cookbook-openstack-identity.git",
14
-      "ref": "3b001b7e07758e2c81b5ae4d1bff8e4a1472b24a"
14
+      "ref": "f4925084e583c29cb9007d9f2e1894761db264ef"
15 15
     },
16 16
     "openstack-common": {
17
-      "locked_version": "8.0.0",
17
+      "locked_version": "8.0.1",
18 18
       "git": "git://github.com/stackforge/cookbook-openstack-common.git",
19
-      "ref": "d5f852daf5d0f3001ddbf1688c43a4bb21e8ca00"
19
+      "ref": "5e7592dc180bc30348afe7b1ecb3328d0fbacc5e"
20 20
     },
21 21
     "apt": {
22
-      "locked_version": "2.3.0"
22
+      "locked_version": "2.3.4"
23 23
     },
24 24
     "selinux": {
25 25
       "locked_version": "0.6.2"
@@ -31,13 +31,13 @@
31 31
       "locked_version": "1.4.2"
32 32
     },
33 33
     "yum": {
34
-      "locked_version": "2.4.4"
34
+      "locked_version": "3.0.2"
35 35
     },
36 36
     "database": {
37
-      "locked_version": "1.4.0"
37
+      "locked_version": "1.6.0"
38 38
     },
39 39
     "mysql": {
40
-      "locked_version": "3.0.0"
40
+      "locked_version": "4.0.14"
41 41
     },
42 42
     "openssl": {
43 43
       "locked_version": "1.1.0"

+ 1
- 0
Gemfile View File

@@ -1,3 +1,4 @@
1
+# encoding: UTF-8
1 2
 source 'https://rubygems.org'
2 3
 
3 4
 gem 'chef', '~> 11.8'

+ 1
- 7
Strainerfile View File

@@ -1,11 +1,5 @@
1 1
 # Strainerfile
2
-rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/Gemfile --config $SANDBOX/$COOKBOOK/.rubocop.yml
3
-rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/metadata.rb --config $SANDBOX/$COOKBOOK/.rubocop.yml
4
-rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/attributes/ --config $SANDBOX/$COOKBOOK/attributes/.rubocop.yml
5
-rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/recipes/ --config $SANDBOX/$COOKBOOK/recipes/.rubocop.yml
6
-rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK/spec/ --config $SANDBOX/$COOKBOOK/spec/.rubocop.yml
7
-# rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK
8
-# may want to add rubocop check for Berksfile and Gemfile
2
+rubocop: bundle exec rubocop $SANDBOX/$COOKBOOK
9 3
 knife test: bundle exec knife cookbook test $COOKBOOK
10 4
 foodcritic: bundle exec foodcritic -f any -t ~FC003 $SANDBOX/$COOKBOOK
11 5
 chefspec: bundle exec rspec $SANDBOX/$COOKBOOK/spec

+ 0
- 9
TESTING.md View File

@@ -14,15 +14,6 @@ To run the tests:
14 14
 
15 15
 [Rubocop](https://github.com/bbatsov/rubocop) is a static Ruby code analyzer, based on the community [Ruby style guide](https://github.com/bbatsov/ruby-style-guide). We are attempting to adhere to this where applicable, slowly cleaning up the cookbooks until we can turn on Rubocop for gating the commits.
16 16
 
17
-### Attribute Rules ###
18
-
19
-Since there are slight style differences between the coding of attributes, recipes and metadata files there are specific `.rubocop.yml` files for each of:
20
-
21
-   [Gemfile and metadata.rb](.rubocop.yml)
22
-   [attributes/*.rb](attributes/.rubocop.yml)
23
-   [recipes/.rubocop.yml](recipes/.rubocop.yml)
24
-   [spec/.rubocop.yml](spec/.rubocop.yml)
25
-
26 17
 ## Knife ##
27 18
 
28 19
 [knife cookbook test](http://docs.opscode.com/chef/knife.html#test) is used to check the cookbook's Ruby and ERB files for basic syntax errors.

+ 0
- 7
attributes/.rubocop.yml View File

@@ -1,7 +0,0 @@
1
-# embedded attributes make for long lines
2
-LineLength:
3
-  Enabled: false
4
-
5
-# %w or %W have not generally been used in attribute files
6
-WordArray:
7
-  Enabled: false

+ 5
- 5
attributes/default.rb View File

@@ -75,11 +75,11 @@ default['openstack']['block-storage']['quota_driver'] = 'cinder.quota.DbQuotaDri
75 75
 default['openstack']['block-storage']['rpc_thread_pool_size'] = 64
76 76
 default['openstack']['block-storage']['rpc_conn_pool_size'] = 30
77 77
 default['openstack']['block-storage']['rpc_response_timeout'] = 60
78
-case node["openstack"]["mq"]["service_type"]
79
-when "rabbitmq"
80
-  default["openstack"]["block_storage"]["rpc_backend"] = "cinder.openstack.common.rpc.impl_kombu"
81
-when "qpid"
82
-  default["openstack"]["block_storage"]["rpc_backend"] = "cinder.openstack.common.rpc.impl_qpid"
78
+case node['openstack']['mq']['service_type']
79
+when 'rabbitmq'
80
+  default['openstack']['block_storage']['rpc_backend'] = 'cinder.openstack.common.rpc.impl_kombu'
81
+when 'qpid'
82
+  default['openstack']['block_storage']['rpc_backend'] = 'cinder.openstack.common.rpc.impl_qpid'
83 83
 end
84 84
 
85 85
 # MQ options

+ 1
- 0
metadata.rb View File

@@ -1,3 +1,4 @@
1
+# encoding: UTF-8
1 2
 name             'openstack-block-storage'
2 3
 maintainer       'AT&T Services, Inc.'
3 4
 maintainer_email 'cookbooks@lists.tfoundry.com'

+ 0
- 15
recipes/.rubocop-todo.yml View File

@@ -1,15 +0,0 @@
1
-# This configuration was generated by `rubocop --auto-gen-config`.
2
-# The point is for the user to remove these configuration records
3
-# one by one as the offences are removed from the code base.
4
-
5
-CollectionMethods:
6
-  Enabled: false
7
-
8
-Documentation:
9
-  Enabled: false
10
-
11
-HashSyntax:
12
-  Enabled: false
13
-
14
-StringLiterals:
15
-  Enabled: false

+ 0
- 3
recipes/.rubocop.yml View File

@@ -1,3 +0,0 @@
1
-# embedded attributes make for long lines
2
-LineLength:
3
-  Enabled: false

+ 31
- 33
recipes/api.rb View File

@@ -25,14 +25,13 @@ class ::Chef::Recipe
25 25
   include ::Openstack
26 26
 end
27 27
 
28
-include_recipe "openstack-block-storage::cinder-common"
28
+include_recipe 'openstack-block-storage::cinder-common'
29 29
 
30
-platform_options = node["openstack"]["block-storage"]["platform"]
30
+platform_options = node['openstack']['block-storage']['platform']
31 31
 
32
-platform_options["cinder_api_packages"].each do |pkg|
32
+platform_options['cinder_api_packages'].each do |pkg|
33 33
   package pkg do
34
-    options platform_options["package_overrides"]
35
-
34
+    options platform_options['package_overrides']
36 35
     action :upgrade
37 36
   end
38 37
 end
@@ -44,44 +43,43 @@ platform_options["#{db_type}_python_packages"].each do |pkg|
44 43
   end
45 44
 end
46 45
 
47
-directory ::File.dirname(node["openstack"]["block-storage"]["api"]["auth"]["cache_dir"]) do
48
-  owner node["openstack"]["block-storage"]["user"]
49
-  group node["openstack"]["block-storage"]["group"]
46
+directory ::File.dirname(node['openstack']['block-storage']['api']['auth']['cache_dir']) do
47
+  owner node['openstack']['block-storage']['user']
48
+  group node['openstack']['block-storage']['group']
50 49
   mode 00700
51 50
 end
52 51
 
53
-service "cinder-api" do
54
-  service_name platform_options["cinder_api_service"]
55
-  supports :status => true, :restart => true
56
-
52
+service 'cinder-api' do
53
+  service_name platform_options['cinder_api_service']
54
+  supports status: true, restart: true
57 55
   action :enable
58
-  subscribes :restart, "template[/etc/cinder/cinder.conf]"
56
+  subscribes :restart, 'template[/etc/cinder/cinder.conf]'
59 57
 end
60 58
 
61
-identity_endpoint = endpoint "identity-api"
62
-identity_admin_endpoint = endpoint "identity-admin"
63
-service_pass = get_password "service", "openstack-block-storage"
59
+identity_endpoint = endpoint 'identity-api'
60
+identity_admin_endpoint = endpoint 'identity-admin'
61
+service_pass = get_password 'service', 'openstack-block-storage'
64 62
 
65
-execute "cinder-manage db sync"
63
+execute 'cinder-manage db sync'
66 64
 
67
-template "/etc/cinder/api-paste.ini" do
68
-  source "api-paste.ini.erb"
69
-  group  node["openstack"]["block-storage"]["group"]
70
-  owner  node["openstack"]["block-storage"]["user"]
71
-  mode   00644
65
+template '/etc/cinder/api-paste.ini' do
66
+  source 'api-paste.ini.erb'
67
+  group node['openstack']['block-storage']['group']
68
+  owner node['openstack']['block-storage']['user']
69
+  mode 00644
72 70
   variables(
73
-    :identity_endpoint => identity_endpoint,
74
-    :identity_admin_endpoint => identity_admin_endpoint,
75
-    :service_pass => service_pass
76
-  )
71
+    identity_endpoint: identity_endpoint,
72
+    identity_admin_endpoint: identity_admin_endpoint,
73
+    service_pass: service_pass
74
+    )
77 75
 
78
-  notifies :restart, "service[cinder-api]", :immediately
76
+  notifies :restart, 'service[cinder-api]', :immediately
79 77
 end
80 78
 
81
-template "/etc/cinder/policy.json" do
82
-  source "policy.json.erb"
83
-  owner  node["openstack"]["block-storage"]["user"]
84
-  group  node["openstack"]["block-storage"]["group"]
85
-  mode   00644
86
-  notifies :restart, "service[cinder-api]"
79
+template '/etc/cinder/policy.json' do
80
+  source 'policy.json.erb'
81
+  owner node['openstack']['block-storage']['user']
82
+  group node['openstack']['block-storage']['group']
83
+  mode 00644
84
+  notifies :restart, 'service[cinder-api]'
87 85
 end

+ 29
- 30
recipes/cinder-common.rb View File

@@ -17,56 +17,55 @@ class ::Chef::Recipe
17 17
   include ::Openstack
18 18
 end
19 19
 
20
-if node["openstack"]["block-storage"]["syslog"]["use"]
21
-  include_recipe "openstack-common::logging"
20
+if node['openstack']['block-storage']['syslog']['use']
21
+  include_recipe 'openstack-common::logging'
22 22
 end
23 23
 
24
-platform_options = node["openstack"]["block-storage"]["platform"]
24
+platform_options = node['openstack']['block-storage']['platform']
25 25
 
26
-platform_options["cinder_common_packages"].each do |pkg|
26
+platform_options['cinder_common_packages'].each do |pkg|
27 27
   package pkg do
28
-    options platform_options["package_overrides"]
29
-
28
+    options platform_options['package_overrides']
30 29
     action :upgrade
31 30
   end
32 31
 end
33 32
 
34
-db_user = node["openstack"]["block-storage"]["db"]["username"]
35
-db_pass = get_password "db", "cinder"
36
-sql_connection = db_uri("volume", db_user, db_pass)
33
+db_user = node['openstack']['block-storage']['db']['username']
34
+db_pass = get_password 'db', 'cinder'
35
+sql_connection = db_uri('volume', db_user, db_pass)
37 36
 
38
-if node["openstack"]["block-storage"]["mq"]["service_type"] == "rabbitmq"
39
-  if node["openstack"]["block-storage"]["rabbit"]["ha"]
37
+if node['openstack']['block-storage']['mq']['service_type'] == 'rabbitmq'
38
+  if node['openstack']['block-storage']['rabbit']['ha']
40 39
     rabbit_hosts = rabbit_servers
41 40
   end
42
-  rabbit_pass = get_password "user", node["openstack"]["block-storage"]["rabbit"]["username"]
41
+  rabbit_pass = get_password 'user', node['openstack']['block-storage']['rabbit']['username']
43 42
 end
44 43
 
45
-glance_api_endpoint = endpoint "image-api"
44
+glance_api_endpoint = endpoint 'image-api'
46 45
 
47
-directory "/etc/cinder" do
48
-  group  node["openstack"]["block-storage"]["group"]
49
-  owner  node["openstack"]["block-storage"]["user"]
46
+directory '/etc/cinder' do
47
+  group node['openstack']['block-storage']['group']
48
+  owner node['openstack']['block-storage']['user']
50 49
   mode 00750
51 50
   action :create
52 51
 end
53 52
 
54
-template "/etc/cinder/cinder.conf" do
55
-  source "cinder.conf.erb"
56
-  group  node["openstack"]["block-storage"]["group"]
57
-  owner  node["openstack"]["block-storage"]["user"]
58
-  mode   00644
53
+template '/etc/cinder/cinder.conf' do
54
+  source 'cinder.conf.erb'
55
+  group node['openstack']['block-storage']['group']
56
+  owner node['openstack']['block-storage']['user']
57
+  mode 00644
59 58
   variables(
60
-    :sql_connection => sql_connection,
61
-    :rabbit_password => rabbit_pass,
62
-    :rabbit_hosts => rabbit_hosts,
63
-    :glance_host => glance_api_endpoint.host,
64
-    :glance_port => glance_api_endpoint.port
59
+    sql_connection: sql_connection,
60
+    rabbit_password: rabbit_pass,
61
+    rabbit_hosts: rabbit_hosts,
62
+    glance_host: glance_api_endpoint.host,
63
+    glance_port: glance_api_endpoint.port
65 64
   )
66 65
 end
67 66
 
68
-directory node["openstack"]["block-storage"]["lock_path"] do
69
-  group  node["openstack"]["block-storage"]["group"]
70
-  owner  node["openstack"]["block-storage"]["user"]
71
-  mode  00700
67
+directory node['openstack']['block-storage']['lock_path'] do
68
+  group node['openstack']['block-storage']['group']
69
+  owner node['openstack']['block-storage']['user']
70
+  mode 00700
72 71
 end

+ 20
- 24
recipes/identity_registration.rb View File

@@ -20,67 +20,63 @@
20 20
 # limitations under the License.
21 21
 #
22 22
 
23
-require "uri"
23
+require 'uri'
24 24
 
25
-class ::Chef::Recipe
25
+class ::Chef::Recipe # rubocop:disable Documentation
26 26
   include ::Openstack
27 27
 end
28 28
 
29
-identity_admin_endpoint = endpoint "identity-admin"
30
-bootstrap_token = secret "secrets", "openstack_identity_bootstrap_token"
29
+identity_admin_endpoint = endpoint 'identity-admin'
30
+bootstrap_token = secret 'secrets', 'openstack_identity_bootstrap_token'
31 31
 auth_uri = ::URI.decode identity_admin_endpoint.to_s
32
-cinder_api_endpoint = endpoint "volume-api"
33
-service_pass = get_password "service", "openstack-block-storage"
34
-region = node["openstack"]["block-storage"]["region"]
35
-service_tenant_name = node["openstack"]["block-storage"]["service_tenant_name"]
36
-service_user = node["openstack"]["block-storage"]["service_user"]
37
-service_role = node["openstack"]["block-storage"]["service_role"]
32
+cinder_api_endpoint = endpoint 'volume-api'
33
+service_pass = get_password 'service', 'openstack-block-storage'
34
+region = node['openstack']['block-storage']['region']
35
+service_tenant_name = node['openstack']['block-storage']['service_tenant_name']
36
+service_user = node['openstack']['block-storage']['service_user']
37
+service_role = node['openstack']['block-storage']['service_role']
38 38
 
39
-openstack_identity_register "Register Cinder Volume Service" do
39
+openstack_identity_register 'Register Cinder Volume Service' do
40 40
   auth_uri auth_uri
41 41
   bootstrap_token bootstrap_token
42
-  service_name "cinder"
43
-  service_type "volume"
44
-  service_description "Cinder Volume Service"
42
+  service_name 'cinder'
43
+  service_type 'volume'
44
+  service_description 'Cinder Volume Service'
45 45
   endpoint_region region
46 46
   endpoint_adminurl ::URI.decode cinder_api_endpoint.to_s
47 47
   endpoint_internalurl ::URI.decode cinder_api_endpoint.to_s
48 48
   endpoint_publicurl ::URI.decode cinder_api_endpoint.to_s
49
-
50 49
   action :create_service
51 50
 end
52 51
 
53
-openstack_identity_register "Register Cinder Volume Endpoint" do
52
+openstack_identity_register 'Register Cinder Volume Endpoint' do
54 53
   auth_uri auth_uri
55 54
   bootstrap_token bootstrap_token
56
-  service_name "cinder"
57
-  service_type "volume"
58
-  service_description "Cinder Volume Service"
55
+  service_name 'cinder'
56
+  service_type 'volume'
57
+  service_description 'Cinder Volume Service'
59 58
   endpoint_region region
60 59
   endpoint_adminurl ::URI.decode cinder_api_endpoint.to_s
61 60
   endpoint_internalurl ::URI.decode cinder_api_endpoint.to_s
62 61
   endpoint_publicurl ::URI.decode cinder_api_endpoint.to_s
63
-
64 62
   action :create_endpoint
65 63
 end
66 64
 
67
-openstack_identity_register "Register Cinder Service User" do
65
+openstack_identity_register 'Register Cinder Service User' do
68 66
   auth_uri auth_uri
69 67
   bootstrap_token bootstrap_token
70 68
   tenant_name service_tenant_name
71 69
   user_name service_user
72 70
   user_pass service_pass
73 71
   user_enabled true # Not required as this is the default
74
-
75 72
   action :create_user
76 73
 end
77 74
 
78
-openstack_identity_register "Grant service Role to Cinder Service User for Cinder Service Tenant" do
75
+openstack_identity_register 'Grant service Role to Cinder Service User for Cinder Service Tenant' do
79 76
   auth_uri auth_uri
80 77
   bootstrap_token bootstrap_token
81 78
   tenant_name service_tenant_name
82 79
   user_name service_user
83 80
   role_name service_role
84
-
85 81
   action :grant_role
86 82
 end

+ 20
- 20
recipes/scheduler.rb View File

@@ -21,13 +21,13 @@
21 21
 # limitations under the License.
22 22
 #
23 23
 
24
-include_recipe "openstack-block-storage::cinder-common"
24
+include_recipe 'openstack-block-storage::cinder-common'
25 25
 
26
-platform_options = node["openstack"]["block-storage"]["platform"]
26
+platform_options = node['openstack']['block-storage']['platform']
27 27
 
28
-platform_options["cinder_scheduler_packages"].each do |pkg|
28
+platform_options['cinder_scheduler_packages'].each do |pkg|
29 29
   package pkg do
30
-    options platform_options["package_overrides"]
30
+    options platform_options['package_overrides']
31 31
 
32 32
     action :upgrade
33 33
   end
@@ -40,30 +40,30 @@ platform_options["#{db_type}_python_packages"].each do |pkg|
40 40
   end
41 41
 end
42 42
 
43
-service "cinder-scheduler" do
44
-  service_name platform_options["cinder_scheduler_service"]
45
-  supports :status => true, :restart => true
43
+service 'cinder-scheduler' do
44
+  service_name platform_options['cinder_scheduler_service']
45
+  supports status: true, restart: true
46 46
   action [:enable, :start]
47
-  subscribes :restart, "template[/etc/cinder/cinder.conf]"
47
+  subscribes :restart, 'template[/etc/cinder/cinder.conf]'
48 48
 end
49 49
 
50
-audit_bin_dir = platform?("ubuntu") ? "/usr/bin" : "/usr/local/bin"
51
-audit_log = node["openstack"]["block-storage"]["cron"]["audit_logfile"]
50
+audit_bin_dir = platform?('ubuntu') ? '/usr/bin' : '/usr/local/bin'
51
+audit_log = node['openstack']['block-storage']['cron']['audit_logfile']
52 52
 
53
-if node["openstack"]["metering"]
54
-  scheduler_role = node["openstack"]["block-storage"]["scheduler_role"]
53
+if node['openstack']['metering']
54
+  scheduler_role = node['openstack']['block-storage']['scheduler_role']
55 55
   results = search(:node, "roles:#{scheduler_role}")
56
-  cron_node = results.collect { |a| a.name }.sort[0]
56
+  cron_node = results.map { |a| a.name }.sort[0]
57 57
   Chef::Log.debug("Volume audit cron node: #{cron_node}")
58 58
 
59
-  cron "cinder-volume-usage-audit" do
60
-    day node["openstack"]["block-storage"]["cron"]["day"] || '*'
61
-    hour node["openstack"]["block-storage"]["cron"]["hour"] || '*'
62
-    minute node["openstack"]["block-storage"]["cron"]["minute"]
63
-    month node["openstack"]["block-storage"]["cron"]["month"] || '*'
64
-    weekday node["openstack"]["block-storage"]["cron"]["weekday"] || '*'
59
+  cron 'cinder-volume-usage-audit' do
60
+    day node['openstack']['block-storage']['cron']['day'] || '*'
61
+    hour node['openstack']['block-storage']['cron']['hour'] || '*'
62
+    minute node['openstack']['block-storage']['cron']['minute']
63
+    month node['openstack']['block-storage']['cron']['month'] || '*'
64
+    weekday node['openstack']['block-storage']['cron']['weekday'] || '*'
65 65
     command "#{audit_bin_dir}/cinder-volume-usage-audit > #{audit_log} 2>&1"
66 66
     action cron_node == node.name ? :create : :delete
67
-    user node["openstack"]["block-storage"]["user"]
67
+    user node['openstack']['block-storage']['user']
68 68
   end
69 69
 end

+ 55
- 55
recipes/volume.rb View File

@@ -26,13 +26,13 @@ class ::Chef::Recipe
26 26
   include ::Openstack
27 27
 end
28 28
 
29
-include_recipe "openstack-block-storage::cinder-common"
29
+include_recipe 'openstack-block-storage::cinder-common'
30 30
 
31
-platform_options = node["openstack"]["block-storage"]["platform"]
31
+platform_options = node['openstack']['block-storage']['platform']
32 32
 
33
-platform_options["cinder_volume_packages"].each do |pkg|
33
+platform_options['cinder_volume_packages'].each do |pkg|
34 34
   package pkg do
35
-    options platform_options["package_overrides"]
35
+    options platform_options['package_overrides']
36 36
     action :upgrade
37 37
   end
38 38
 end
@@ -44,103 +44,103 @@ platform_options["#{db_type}_python_packages"].each do |pkg|
44 44
   end
45 45
 end
46 46
 
47
-platform_options["cinder_iscsitarget_packages"].each do |pkg|
47
+platform_options['cinder_iscsitarget_packages'].each do |pkg|
48 48
   package pkg do
49
-    options platform_options["package_overrides"]
49
+    options platform_options['package_overrides']
50 50
     action :upgrade
51 51
   end
52 52
 end
53 53
 
54
-case node["openstack"]["block-storage"]["volume"]["driver"]
55
-when "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver"
56
-  node.override["openstack"]["block-storage"]["netapp"]["dfm_password"] = get_password "service", "netapp"
54
+case node['openstack']['block-storage']['volume']['driver']
55
+when 'cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver'
56
+  node.override['openstack']['block-storage']['netapp']['dfm_password'] = get_password 'service', 'netapp'
57 57
 
58
-when "cinder.volume.drivers.RBDDriver"
59
-  node.override["openstack"]["block-storage"]["rbd_secret_uuid"] = get_password "service", "rbd"
58
+when 'cinder.volume.drivers.RBDDriver'
59
+  node.override['openstack']['block-storage']['rbd_secret_uuid'] = get_password 'service', 'rbd'
60 60
 
61
-when "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver"
62
-  node.override["openstack"]["block-storage"]["netapp"]["netapp_server_password"] = get_password "service", "netapp-filer"
61
+when 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
62
+  node.override['openstack']['block-storage']['netapp']['netapp_server_password'] = get_password 'service', 'netapp-filer'
63 63
 
64
-  directory node["openstack"]["block-storage"]["nfs"]["mount_point_base"] do
65
-    owner node["openstack"]["block-storage"]["user"]
66
-    group node["openstack"]["block-storage"]["group"]
64
+  directory node['openstack']['block-storage']['nfs']['mount_point_base'] do
65
+    owner node['openstack']['block-storage']['user']
66
+    group node['openstack']['block-storage']['group']
67 67
     action :create
68 68
   end
69 69
 
70
-  template node["openstack"]["block-storage"]["nfs"]["shares_config"] do
71
-    source "shares.conf.erb"
72
-    mode "0600"
73
-    owner node["openstack"]["block-storage"]["user"]
74
-    group node["openstack"]["block-storage"]["group"]
70
+  template node['openstack']['block-storage']['nfs']['shares_config'] do
71
+    source 'shares.conf.erb'
72
+    mode '0600'
73
+    owner node['openstack']['block-storage']['user']
74
+    group node['openstack']['block-storage']['group']
75 75
     variables(
76
-      "host" => node["openstack"]["block-storage"]["netapp"]["netapp_server_hostname"],
77
-      "export" => node["openstack"]["block-storage"]["netapp"]["export"]
76
+      host: node['openstack']['block-storage']['netapp']['netapp_server_hostname'],
77
+      export: node['openstack']['block-storage']['netapp']['export']
78 78
     )
79
-    notifies :restart, "service[cinder-volume]"
79
+    notifies :restart, 'service[cinder-volume]'
80 80
   end
81 81
 
82
-  platform_options["cinder_nfs_packages"].each do |pkg|
82
+  platform_options['cinder_nfs_packages'].each do |pkg|
83 83
     package pkg do
84
-      options platform_options["package_overrides"]
84
+      options platform_options['package_overrides']
85 85
       action :upgrade
86 86
     end
87 87
   end
88 88
 
89
-when "cinder.volume.drivers.storwize_svc.StorwizeSVCDriver"
89
+when 'cinder.volume.drivers.storwize_svc.StorwizeSVCDriver'
90 90
   file node['openstack']['block-storage']['san']['san_private_key'] do
91
-    mode "0400"
92
-    owner node["openstack"]["block-storage"]["user"]
93
-    group node["openstack"]["block-storage"]["group"]
94
-end
91
+    mode '0400'
92
+    owner node['openstack']['block-storage']['user']
93
+    group node['openstack']['block-storage']['group']
94
+  end
95 95
 
96
-when "cinder.volume.drivers.lvm.LVMISCSIDriver"
97
-  if node["openstack"]["block-storage"]["volume"]["create_volume_group"]
98
-    volume_size = node["openstack"]["block-storage"]["volume"]["volume_group_size"]
96
+when 'cinder.volume.drivers.lvm.LVMISCSIDriver'
97
+  if node['openstack']['block-storage']['volume']['create_volume_group']
98
+    volume_size = node['openstack']['block-storage']['volume']['volume_group_size']
99 99
     seek_count = volume_size.to_i * 1024
100 100
     # default volume group is 40G
101 101
     seek_count = 40 * 1024 if seek_count == 0
102
-    vg_name = node["openstack"]["block-storage"]["volume"]["volume_group"]
103
-    vg_file = "#{node["openstack"]["block-storage"]["volume"]["state_path"]}/#{vg_name}.img"
102
+    vg_name = node['openstack']['block-storage']['volume']['volume_group']
103
+    vg_file = "#{node['openstack']['block-storage']['volume']['state_path']}/#{vg_name}.img"
104 104
 
105 105
     # create volume group
106
-    execute "Create Cinder volume group" do
106
+    execute 'Create Cinder volume group' do
107 107
       command "dd if=/dev/zero of=#{vg_file} bs=1M seek=#{seek_count} count=0; vgcreate #{vg_name} $(losetup --show -f #{vg_file})"
108 108
       action :run
109 109
       not_if "vgs #{vg_name}"
110 110
     end
111 111
 
112
-    template "/etc/init.d/cinder-group-active" do
113
-      source "cinder-group-active.erb"
114
-      mode "755"
112
+    template '/etc/init.d/cinder-group-active' do
113
+      source 'cinder-group-active.erb'
114
+      mode '755'
115 115
       variables(
116
-        "volume_file" => vg_file
116
+        volume_file: vg_file
117 117
       )
118
-      notifies :start, "service[cinder-group-active]", :immediately
118
+      notifies :start, 'service[cinder-group-active]', :immediately
119 119
     end
120 120
 
121
-    service "cinder-group-active" do
122
-      service_name "cinder-group-active"
121
+    service 'cinder-group-active' do
122
+      service_name 'cinder-group-active'
123 123
 
124
-      action [ :enable, :start ]
124
+      action [:enable, :start]
125 125
     end
126 126
   end
127 127
 end
128 128
 
129
-service "cinder-volume" do
130
-  service_name platform_options["cinder_volume_service"]
131
-  supports :status => true, :restart => true
129
+service 'cinder-volume' do
130
+  service_name platform_options['cinder_volume_service']
131
+  supports status: true, restart: true
132 132
   action [:enable, :start]
133
-  subscribes :restart, "template[/etc/cinder/cinder.conf]"
133
+  subscribes :restart, 'template[/etc/cinder/cinder.conf]'
134 134
 end
135 135
 
136
-service "iscsitarget" do
137
-  service_name platform_options["cinder_iscsitarget_service"]
138
-  supports :status => true, :restart => true
136
+service 'iscsitarget' do
137
+  service_name platform_options['cinder_iscsitarget_service']
138
+  supports status: true, restart: true
139 139
   action :enable
140 140
 end
141 141
 
142
-template "/etc/tgt/targets.conf" do
143
-  source "targets.conf.erb"
142
+template '/etc/tgt/targets.conf' do
143
+  source 'targets.conf.erb'
144 144
   mode   00600
145
-  notifies :restart, "service[iscsitarget]", :immediately
145
+  notifies :restart, 'service[iscsitarget]', :immediately
146 146
 end

+ 0
- 17
spec/.rubocop-todo.yml View File

@@ -1,17 +0,0 @@
1
-# This configuration was generated by `rubocop --auto-gen-config`.
2
-# The point is for the user to remove these configuration records
3
-# one by one as the offences are removed from the code base.
4
-
5
-HashSyntax:
6
-  Enabled: false
7
-
8
-MethodLength:
9
-  Enabled: false
10
-
11
-StringLiterals:
12
-  Enabled: false
13
-
14
-### in the .rubocop.yml
15
-# embedded attributes make for long lines
16
-LineLength:
17
-  Enabled: false

+ 0
- 3
spec/.rubocop.yml View File

@@ -1,3 +0,0 @@
1
-# embedded attributes make for long lines
2
-LineLength:
3
-  Enabled: false

+ 17
- 17
spec/api-opensuse_spec.rb View File

@@ -2,41 +2,41 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::api" do
7
+describe 'openstack-block-storage::api' do
8 8
   before { block_storage_stubs }
9
-  describe "opensuse" do
9
+  describe 'opensuse' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
12
-      @chef_run.converge "openstack-block-storage::api"
12
+      @chef_run.converge 'openstack-block-storage::api'
13 13
     end
14 14
 
15
-    it "installs cinder api packages" do
16
-      expect(@chef_run).to upgrade_package "openstack-cinder-api"
15
+    it 'installs cinder api packages' do
16
+      expect(@chef_run).to upgrade_package 'openstack-cinder-api'
17 17
     end
18 18
 
19
-    it "installs mysql python packages by default" do
20
-      expect(@chef_run).to upgrade_package "python-mysql"
19
+    it 'installs mysql python packages by default' do
20
+      expect(@chef_run).to upgrade_package 'python-mysql'
21 21
     end
22 22
 
23
-    it "installs postgresql python packages if explicitly told" do
23
+    it 'installs postgresql python packages if explicitly told' do
24 24
       chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
25 25
       node = chef_run.node
26
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
27
-      chef_run.converge "openstack-block-storage::api"
26
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
27
+      chef_run.converge 'openstack-block-storage::api'
28 28
 
29
-      expect(chef_run).to upgrade_package "python-psycopg2"
30
-      expect(chef_run).not_to upgrade_package "python-mysql"
29
+      expect(chef_run).to upgrade_package 'python-psycopg2'
30
+      expect(chef_run).not_to upgrade_package 'python-mysql'
31 31
     end
32 32
 
33
-    it "starts cinder api on boot" do
34
-      expect(@chef_run).to enable_service "openstack-cinder-api"
33
+    it 'starts cinder api on boot' do
34
+      expect(@chef_run).to enable_service 'openstack-cinder-api'
35 35
     end
36 36
 
37 37
     expect_creates_policy_json(
38
-      "service[cinder-api]", "openstack-cinder", "openstack-cinder")
38
+      'service[cinder-api]', 'openstack-cinder', 'openstack-cinder')
39 39
     expect_creates_cinder_conf(
40
-      "service[cinder-api]", "openstack-cinder", "openstack-cinder")
40
+      'service[cinder-api]', 'openstack-cinder', 'openstack-cinder')
41 41
   end
42 42
 end

+ 19
- 19
spec/api-redhat_spec.rb View File

@@ -2,47 +2,47 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::api" do
7
+describe 'openstack-block-storage::api' do
8 8
   before { block_storage_stubs }
9
-  describe "redhat" do
9
+  describe 'redhat' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
12
-      @chef_run.converge "openstack-block-storage::api"
12
+      @chef_run.converge 'openstack-block-storage::api'
13 13
     end
14 14
 
15
-    it "installs cinder api packages" do
16
-      expect(@chef_run).to upgrade_package "python-cinderclient"
15
+    it 'installs cinder api packages' do
16
+      expect(@chef_run).to upgrade_package 'python-cinderclient'
17 17
     end
18 18
 
19
-    it "installs mysql python packages by default" do
20
-      expect(@chef_run).to upgrade_package "MySQL-python"
19
+    it 'installs mysql python packages by default' do
20
+      expect(@chef_run).to upgrade_package 'MySQL-python'
21 21
     end
22 22
 
23
-    it "installs db2 python packages if explicitly told" do
23
+    it 'installs db2 python packages if explicitly told' do
24 24
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
25 25
       node = chef_run.node
26
-      node.set["openstack"]["db"]["volume"]["db_type"] = "db2"
27
-      chef_run.converge "openstack-block-storage::api"
26
+      node.set['openstack']['db']['volume']['db_type'] = 'db2'
27
+      chef_run.converge 'openstack-block-storage::api'
28 28
 
29
-      ["db2-odbc", "python-ibm-db", "python-ibm-db-sa"].each do |pkg|
29
+      ['db2-odbc', 'python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
30 30
         expect(chef_run).to upgrade_package pkg
31 31
       end
32 32
     end
33 33
 
34
-    it "installs postgresql python packages if explicitly told" do
34
+    it 'installs postgresql python packages if explicitly told' do
35 35
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
36 36
       node = chef_run.node
37
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
38
-      chef_run.converge "openstack-block-storage::api"
37
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
38
+      chef_run.converge 'openstack-block-storage::api'
39 39
 
40
-      expect(chef_run).to upgrade_package "python-psycopg2"
41
-      expect(chef_run).not_to upgrade_package "MySQL-python"
40
+      expect(chef_run).to upgrade_package 'python-psycopg2'
41
+      expect(chef_run).not_to upgrade_package 'MySQL-python'
42 42
     end
43 43
 
44
-    it "starts cinder api on boot" do
45
-      expect(@chef_run).to enable_service "openstack-cinder-api"
44
+    it 'starts cinder api on boot' do
45
+      expect(@chef_run).to enable_service 'openstack-cinder-api'
46 46
     end
47 47
   end
48 48
 end

+ 65
- 65
spec/api_spec.rb View File

@@ -2,152 +2,152 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::api" do
7
+describe 'openstack-block-storage::api' do
8 8
   before { block_storage_stubs }
9
-  describe "ubuntu" do
9
+  describe 'ubuntu' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
12
-        n.set["openstack"]["block-storage"]["syslog"]["use"] = true
12
+        n.set['openstack']['block-storage']['syslog']['use'] = true
13 13
       end
14
-      @chef_run.converge "openstack-block-storage::api"
14
+      @chef_run.converge 'openstack-block-storage::api'
15 15
     end
16 16
 
17 17
     expect_runs_openstack_common_logging_recipe
18 18
 
19
-    it "doesn't run logging recipe" do
19
+    it 'does not run logging recipe' do
20 20
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
21
-      chef_run.converge "openstack-block-storage::api"
21
+      chef_run.converge 'openstack-block-storage::api'
22 22
 
23
-      expect(chef_run).not_to include_recipe "openstack-common::logging"
23
+      expect(chef_run).not_to include_recipe 'openstack-common::logging'
24 24
     end
25 25
 
26
-    it "installs cinder api packages" do
27
-      expect(@chef_run).to upgrade_package "cinder-api"
28
-      expect(@chef_run).to upgrade_package "python-cinderclient"
26
+    it 'installs cinder api packages' do
27
+      expect(@chef_run).to upgrade_package 'cinder-api'
28
+      expect(@chef_run).to upgrade_package 'python-cinderclient'
29 29
     end
30 30
 
31
-    it "installs mysql python packages by default" do
32
-      expect(@chef_run).to upgrade_package "python-mysqldb"
31
+    it 'installs mysql python packages by default' do
32
+      expect(@chef_run).to upgrade_package 'python-mysqldb'
33 33
     end
34 34
 
35
-    it "installs postgresql python packages if explicitly told" do
35
+    it 'installs postgresql python packages if explicitly told' do
36 36
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
37 37
       node = chef_run.node
38
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
39
-      chef_run.converge "openstack-block-storage::api"
38
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
39
+      chef_run.converge 'openstack-block-storage::api'
40 40
 
41
-      expect(chef_run).to upgrade_package "python-psycopg2"
42
-      expect(chef_run).not_to upgrade_package "python-mysqldb"
41
+      expect(chef_run).to upgrade_package 'python-psycopg2'
42
+      expect(chef_run).not_to upgrade_package 'python-mysqldb'
43 43
     end
44 44
 
45
-    describe "/var/cache/cinder" do
45
+    describe '/var/cache/cinder' do
46 46
       before do
47
-        @dir = @chef_run.directory "/var/cache/cinder"
47
+        @dir = @chef_run.directory '/var/cache/cinder'
48 48
       end
49 49
 
50
-      it "has proper owner" do
51
-        expect(@dir.owner).to eq("cinder")
52
-        expect(@dir.group).to eq("cinder")
50
+      it 'has proper owner' do
51
+        expect(@dir.owner).to eq('cinder')
52
+        expect(@dir.group).to eq('cinder')
53 53
       end
54 54
 
55
-      it "has proper modes" do
56
-        expect(sprintf("%o", @dir.mode)).to eq "700"
55
+      it 'has proper modes' do
56
+        expect(sprintf('%o', @dir.mode)).to eq '700'
57 57
       end
58 58
     end
59 59
 
60
-    it "starts cinder api on boot" do
61
-      expect(@chef_run).to enable_service "cinder-api"
60
+    it 'starts cinder api on boot' do
61
+      expect(@chef_run).to enable_service 'cinder-api'
62 62
     end
63 63
 
64
-    expect_creates_cinder_conf "service[cinder-api]", "cinder", "cinder"
64
+    expect_creates_cinder_conf 'service[cinder-api]', 'cinder', 'cinder'
65 65
 
66
-    describe "cinder.conf" do
66
+    describe 'cinder.conf' do
67 67
       before do
68
-        @file = "/etc/cinder/cinder.conf"
68
+        @file = '/etc/cinder/cinder.conf'
69 69
       end
70 70
 
71
-      it "runs logging recipe if node attributes say to" do
72
-        expect(@chef_run).to render_file(@file).with_content("log_config = /etc/openstack/logging.conf")
71
+      it 'runs logging recipe if node attributes say to' do
72
+        expect(@chef_run).to render_file(@file).with_content('log_config = /etc/openstack/logging.conf')
73 73
       end
74 74
 
75
-      it "doesn't run logging recipe" do
75
+      it 'does not run logging recipe' do
76 76
         chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
77
-        chef_run.converge "openstack-block-storage::api"
77
+        chef_run.converge 'openstack-block-storage::api'
78 78
 
79
-        expect(chef_run).not_to render_file(@file).with_content("log_config = /etc/openstack/logging.conf")
79
+        expect(chef_run).not_to render_file(@file).with_content('log_config = /etc/openstack/logging.conf')
80 80
       end
81 81
 
82
-      it "has rbd driver settings" do
82
+      it 'has rbd driver settings' do
83 83
         chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
84
-          n.set["openstack"]["block-storage"]["volume"] = {
85
-            "driver" => "cinder.volume.drivers.RBDDriver"
84
+          n.set['openstack']['block-storage']['volume'] = {
85
+            'driver' => 'cinder.volume.drivers.RBDDriver'
86 86
           }
87 87
         end
88
-        chef_run.converge "openstack-block-storage::api"
88
+        chef_run.converge 'openstack-block-storage::api'
89 89
 
90 90
         expect(chef_run).to render_file(@file).with_content(/^rbd_/)
91 91
         expect(chef_run).not_to render_file(@file).with_content(/^netapp_/)
92 92
       end
93 93
 
94
-      it "has netapp driver settings" do
94
+      it 'has netapp driver settings' do
95 95
         chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
96
-          n.set["openstack"]["block-storage"]["volume"] = {
97
-            "driver" => "cinder.volume.drivers.netapp.NetAppISCSIDriver"
96
+          n.set['openstack']['block-storage']['volume'] = {
97
+            'driver' => 'cinder.volume.drivers.netapp.NetAppISCSIDriver'
98 98
           }
99 99
         end
100
-        chef_run.converge "openstack-block-storage::api"
100
+        chef_run.converge 'openstack-block-storage::api'
101 101
 
102 102
         expect(chef_run).to render_file(@file).with_content(/^netapp_/)
103 103
         expect(chef_run).not_to render_file(@file).with_content(/^rbd_/)
104 104
       end
105 105
     end
106 106
 
107
-    it "runs db migrations" do
108
-      cmd = "cinder-manage db sync"
107
+    it 'runs db migrations' do
108
+      cmd = 'cinder-manage db sync'
109 109
 
110 110
       expect(@chef_run).to run_execute(cmd)
111 111
     end
112 112
 
113
-    expect_creates_policy_json "service[cinder-api]", "cinder", "cinder"
113
+    expect_creates_policy_json 'service[cinder-api]', 'cinder', 'cinder'
114 114
 
115
-    describe "api-paste.ini" do
115
+    describe 'api-paste.ini' do
116 116
       before do
117
-        @file = @chef_run.template "/etc/cinder/api-paste.ini"
117
+        @file = @chef_run.template '/etc/cinder/api-paste.ini'
118 118
       end
119 119
 
120
-      it "has proper owner" do
121
-        expect(@file.owner).to eq("cinder")
122
-        expect(@file.group).to eq("cinder")
120
+      it 'has proper owner' do
121
+        expect(@file.owner).to eq('cinder')
122
+        expect(@file.group).to eq('cinder')
123 123
       end
124 124
 
125
-      it "has proper modes" do
126
-        expect(sprintf("%o", @file.mode)).to eq "644"
125
+      it 'has proper modes' do
126
+        expect(sprintf('%o', @file.mode)).to eq '644'
127 127
       end
128 128
 
129
-      it "has signing_dir" do
130
-        expect(@chef_run).to render_file(@file.name).with_content("signing_dir = /var/cache/cinder/api")
129
+      it 'has signing_dir' do
130
+        expect(@chef_run).to render_file(@file.name).with_content('signing_dir = /var/cache/cinder/api')
131 131
       end
132 132
 
133
-      it "notifies cinder-api restart" do
134
-        expect(@file).to notify("service[cinder-api]").to(:restart)
133
+      it 'notifies cinder-api restart' do
134
+        expect(@file).to notify('service[cinder-api]').to(:restart)
135 135
       end
136 136
 
137
-      it "has auth_uri" do
138
-        expect(@chef_run).to render_file(@file.name).with_content("auth_uri = http://127.0.0.1:5000/v2.0")
137
+      it 'has auth_uri' do
138
+        expect(@chef_run).to render_file(@file.name).with_content('auth_uri = http://127.0.0.1:5000/v2.0')
139 139
       end
140 140
 
141
-      it "has auth_host" do
142
-        expect(@chef_run).to render_file(@file.name).with_content("auth_host = 127.0.0.1")
141
+      it 'has auth_host' do
142
+        expect(@chef_run).to render_file(@file.name).with_content('auth_host = 127.0.0.1')
143 143
       end
144 144
 
145
-      it "has auth_port" do
146
-        expect(@chef_run).to render_file(@file.name).with_content("auth_port = 35357")
145
+      it 'has auth_port' do
146
+        expect(@chef_run).to render_file(@file.name).with_content('auth_port = 35357')
147 147
       end
148 148
 
149
-      it "has auth_protocol" do
150
-        expect(@chef_run).to render_file(@file.name).with_content("auth_protocol = http")
149
+      it 'has auth_protocol' do
150
+        expect(@chef_run).to render_file(@file.name).with_content('auth_protocol = http')
151 151
       end
152 152
     end
153 153
   end

+ 8
- 8
spec/cinder_common-opensuse_spec.rb View File

@@ -2,21 +2,21 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::cinder-common" do
7
+describe 'openstack-block-storage::cinder-common' do
8 8
   before { block_storage_stubs }
9 9
   before do
10 10
     @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS do |n|
11
-      n.set["openstack"]["mq"] = {
12
-        "host" => "127.0.0.1"
11
+      n.set['openstack']['mq'] = {
12
+        'host' => '127.0.0.1'
13 13
       }
14
-      n.set["openstack"]["block-storage"]["syslog"]["use"] = true
14
+      n.set['openstack']['block-storage']['syslog']['use'] = true
15 15
     end
16
-    @chef_run.converge "openstack-block-storage::cinder-common"
16
+    @chef_run.converge 'openstack-block-storage::cinder-common'
17 17
   end
18 18
 
19
-  it "installs the openstack-cinder package" do
20
-    expect(@chef_run).to upgrade_package "openstack-cinder"
19
+  it 'installs the openstack-cinder package' do
20
+    expect(@chef_run).to upgrade_package 'openstack-cinder'
21 21
   end
22 22
 end

+ 8
- 8
spec/cinder_common-redhat_spec.rb View File

@@ -2,21 +2,21 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::cinder-common" do
7
+describe 'openstack-block-storage::cinder-common' do
8 8
   before { block_storage_stubs }
9 9
   before do
10 10
     @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS do |n|
11
-      n.set["openstack"]["mq"] = {
12
-        "host" => "127.0.0.1"
11
+      n.set['openstack']['mq'] = {
12
+        'host' => '127.0.0.1'
13 13
       }
14
-      n.set["openstack"]["block-storage"]["syslog"]["use"] = true
14
+      n.set['openstack']['block-storage']['syslog']['use'] = true
15 15
     end
16
-    @chef_run.converge "openstack-block-storage::cinder-common"
16
+    @chef_run.converge 'openstack-block-storage::cinder-common'
17 17
   end
18 18
 
19
-  it "installs the openstack-cinder package" do
20
-    expect(@chef_run).to upgrade_package "openstack-cinder"
19
+  it 'installs the openstack-cinder package' do
20
+    expect(@chef_run).to upgrade_package 'openstack-cinder'
21 21
   end
22 22
 end

+ 105
- 105
spec/cinder_common_spec.rb View File

@@ -2,224 +2,224 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::cinder-common" do
7
+describe 'openstack-block-storage::cinder-common' do
8 8
   before { block_storage_stubs }
9 9
   before do
10 10
     @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
11
-      n.set["openstack"]["mq"] = {
12
-        "host" => "127.0.0.1"
11
+      n.set['openstack']['mq'] = {
12
+        'host' => '127.0.0.1'
13 13
       }
14 14
 
15 15
     end
16
-    @chef_run.converge "openstack-block-storage::cinder-common"
16
+    @chef_run.converge 'openstack-block-storage::cinder-common'
17 17
   end
18 18
 
19
-  it "installs the cinder-common package" do
20
-    expect(@chef_run).to upgrade_package "cinder-common"
19
+  it 'installs the cinder-common package' do
20
+    expect(@chef_run).to upgrade_package 'cinder-common'
21 21
   end
22 22
 
23
-  describe "/etc/cinder" do
23
+  describe '/etc/cinder' do
24 24
     before do
25
-      @dir = @chef_run.directory "/etc/cinder"
25
+      @dir = @chef_run.directory '/etc/cinder'
26 26
     end
27 27
 
28
-    it "has proper owner" do
29
-      expect(@dir.owner).to eq("cinder")
30
-      expect(@dir.group).to eq("cinder")
28
+    it 'has proper owner' do
29
+      expect(@dir.owner).to eq('cinder')
30
+      expect(@dir.group).to eq('cinder')
31 31
     end
32 32
 
33
-    it "has proper modes" do
34
-      expect(sprintf("%o", @dir.mode)).to eq "750"
33
+    it 'has proper modes' do
34
+      expect(sprintf('%o', @dir.mode)).to eq '750'
35 35
     end
36 36
   end
37 37
 
38
-  describe "cinder.conf" do
38
+  describe 'cinder.conf' do
39 39
     before do
40
-      @file = @chef_run.template "/etc/cinder/cinder.conf"
40
+      @file = @chef_run.template '/etc/cinder/cinder.conf'
41 41
     end
42 42
 
43
-    it "has proper owner" do
44
-      expect(@file.owner).to eq("cinder")
45
-      expect(@file.group).to eq("cinder")
43
+    it 'has proper owner' do
44
+      expect(@file.owner).to eq('cinder')
45
+      expect(@file.group).to eq('cinder')
46 46
     end
47 47
 
48
-    it "has proper modes" do
49
-      expect(sprintf("%o", @file.mode)).to eq "644"
48
+    it 'has proper modes' do
49
+      expect(sprintf('%o', @file.mode)).to eq '644'
50 50
     end
51 51
 
52
-    it "has name templates" do
53
-      expect(@chef_run).to render_file(@file.name).with_content("volume_name_template=volume-%s")
54
-      expect(@chef_run).to render_file(@file.name).with_content("snapshot_name_template=snapshot-%s")
52
+    it 'has name templates' do
53
+      expect(@chef_run).to render_file(@file.name).with_content('volume_name_template=volume-%s')
54
+      expect(@chef_run).to render_file(@file.name).with_content('snapshot_name_template=snapshot-%s')
55 55
     end
56 56
 
57
-    it "has rpc_backend set" do
58
-      expect(@chef_run).to render_file(@file.name).with_content("rpc_backend=cinder.openstack.common.rpc.impl_kombu")
57
+    it 'has rpc_backend set' do
58
+      expect(@chef_run).to render_file(@file.name).with_content('rpc_backend=cinder.openstack.common.rpc.impl_kombu')
59 59
     end
60 60
 
61
-    it "has has volumes_dir set" do
62
-      expect(@chef_run).to render_file(@file.name).with_content("volumes_dir=/var/lib/cinder/volumes")
61
+    it 'has has volumes_dir set' do
62
+      expect(@chef_run).to render_file(@file.name).with_content('volumes_dir=/var/lib/cinder/volumes')
63 63
     end
64 64
 
65
-    it "has correct volume.driver set" do
66
-      expect(@chef_run).to render_file(@file.name).with_content("volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver")
65
+    it 'has correct volume.driver set' do
66
+      expect(@chef_run).to render_file(@file.name).with_content('volume_driver=cinder.volume.drivers.lvm.LVMISCSIDriver')
67 67
     end
68 68
 
69
-    it "has rpc_thread_pool_size" do
70
-      expect(@chef_run).to render_file(@file.name).with_content("rpc_thread_pool_size=64")
69
+    it 'has rpc_thread_pool_size' do
70
+      expect(@chef_run).to render_file(@file.name).with_content('rpc_thread_pool_size=64')
71 71
     end
72 72
 
73
-    it "has rpc_conn_pool_size" do
74
-      expect(@chef_run).to render_file(@file.name).with_content("rpc_conn_pool_size=30")
73
+    it 'has rpc_conn_pool_size' do
74
+      expect(@chef_run).to render_file(@file.name).with_content('rpc_conn_pool_size=30')
75 75
     end
76 76
 
77
-    it "has rpc_response_timeout" do
78
-      expect(@chef_run).to render_file(@file.name).with_content("rpc_response_timeout=60")
77
+    it 'has rpc_response_timeout' do
78
+      expect(@chef_run).to render_file(@file.name).with_content('rpc_response_timeout=60')
79 79
     end
80 80
 
81
-    it "has rabbit_host" do
82
-      expect(@chef_run).to render_file(@file.name).with_content("rabbit_host=127.0.0.1")
81
+    it 'has rabbit_host' do
82
+      expect(@chef_run).to render_file(@file.name).with_content('rabbit_host=127.0.0.1')
83 83
     end
84 84
 
85
-    it "does not have rabbit_hosts" do
86
-      expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_hosts=")
85
+    it 'does not have rabbit_hosts' do
86
+      expect(@chef_run).not_to render_file(@file.name).with_content('rabbit_hosts=')
87 87
     end
88 88
 
89
-    it "does not have rabbit_ha_queues" do
90
-      expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_ha_queues=")
89
+    it 'does not have rabbit_ha_queues' do
90
+      expect(@chef_run).not_to render_file(@file.name).with_content('rabbit_ha_queues=')
91 91
     end
92 92
 
93
-    it "has log_file" do
94
-      expect(@chef_run).to render_file(@file.name).with_content("log_file = /var/log/cinder/cinder.log")
93
+    it 'has log_file' do
94
+      expect(@chef_run).to render_file(@file.name).with_content('log_file = /var/log/cinder/cinder.log')
95 95
     end
96 96
 
97
-    it "has log_config when syslog is true" do
97
+    it 'has log_config when syslog is true' do
98 98
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
99
-        n.set["openstack"]["block-storage"]["syslog"]["use"] = true
99
+        n.set['openstack']['block-storage']['syslog']['use'] = true
100 100
       end
101
-      chef_run.converge "openstack-block-storage::cinder-common"
101
+      chef_run.converge 'openstack-block-storage::cinder-common'
102 102
 
103
-      expect(chef_run).to render_file(@file.name).with_content("log_config = /etc/openstack/logging.conf")
103
+      expect(chef_run).to render_file(@file.name).with_content('log_config = /etc/openstack/logging.conf')
104 104
     end
105 105
 
106
-    it "has rabbit_port" do
107
-      expect(@chef_run).to render_file(@file.name).with_content("rabbit_port=5672")
106
+    it 'has rabbit_port' do
107
+      expect(@chef_run).to render_file(@file.name).with_content('rabbit_port=5672')
108 108
     end
109 109
 
110
-    it "has rabbit_userid" do
111
-      expect(@chef_run).to render_file(@file.name).with_content("rabbit_userid=guest")
110
+    it 'has rabbit_userid' do
111
+      expect(@chef_run).to render_file(@file.name).with_content('rabbit_userid=guest')
112 112
     end
113 113
 
114
-    it "has rabbit_password" do
115
-      expect(@chef_run).to render_file(@file.name).with_content("rabbit_password=rabbit-pass")
114
+    it 'has rabbit_password' do
115
+      expect(@chef_run).to render_file(@file.name).with_content('rabbit_password=rabbit-pass')
116 116
     end
117 117
 
118
-    it "has rabbit_virtual_host" do
119
-      expect(@chef_run).to render_file(@file.name).with_content("rabbit_virtual_host=/")
118
+    it 'has rabbit_virtual_host' do
119
+      expect(@chef_run).to render_file(@file.name).with_content('rabbit_virtual_host=/')
120 120
     end
121 121
 
122
-    describe "rabbit ha" do
122
+    describe 'rabbit ha' do
123 123
       before do
124 124
         @chef_run = ::ChefSpec::Runner.new(::UBUNTU_OPTS) do |n|
125
-          n.set["openstack"]["block-storage"]["rabbit"]["ha"] = true
125
+          n.set['openstack']['block-storage']['rabbit']['ha'] = true
126 126
         end
127
-        @chef_run.converge "openstack-block-storage::cinder-common"
127
+        @chef_run.converge 'openstack-block-storage::cinder-common'
128 128
       end
129 129
 
130
-      it "has rabbit_hosts" do
131
-        expect(@chef_run).to render_file(@file.name).with_content("rabbit_hosts=1.1.1.1:5672,2.2.2.2:5672")
130
+      it 'has rabbit_hosts' do
131
+        expect(@chef_run).to render_file(@file.name).with_content('rabbit_hosts=1.1.1.1:5672,2.2.2.2:5672')
132 132
       end
133 133
 
134
-      it "has rabbit_ha_queues" do
135
-        expect(@chef_run).to render_file(@file.name).with_content("rabbit_ha_queues=True")
134
+      it 'has rabbit_ha_queues' do
135
+        expect(@chef_run).to render_file(@file.name).with_content('rabbit_ha_queues=True')
136 136
       end
137 137
 
138
-      it "does not have rabbit_host" do
139
-        expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_host=127.0.0.1")
138
+      it 'does not have rabbit_host' do
139
+        expect(@chef_run).not_to render_file(@file.name).with_content('rabbit_host=127.0.0.1')
140 140
       end
141 141
 
142
-      it "does not have rabbit_port" do
143
-        expect(@chef_run).not_to render_file(@file.name).with_content("rabbit_port=5672")
142
+      it 'does not have rabbit_port' do
143
+        expect(@chef_run).not_to render_file(@file.name).with_content('rabbit_port=5672')
144 144
       end
145 145
     end
146 146
 
147
-    describe "qpid" do
147
+    describe 'qpid' do
148 148
       before do
149
-        @file = @chef_run.template "/etc/cinder/cinder.conf"
150
-        @chef_run.node.set['openstack']['block-storage']['mq']['service_type'] = "qpid"
149
+        @file = @chef_run.template '/etc/cinder/cinder.conf'
150
+        @chef_run.node.set['openstack']['block-storage']['mq']['service_type'] = 'qpid'
151 151
       end
152 152
 
153
-      it "has qpid_hostname" do
154
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_hostname=127.0.0.1")
153
+      it 'has qpid_hostname' do
154
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_hostname=127.0.0.1')
155 155
       end
156 156
 
157
-      it "has qpid_port" do
158
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_port=5672")
157
+      it 'has qpid_port' do
158
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_port=5672')
159 159
       end
160 160
 
161
-      it "has qpid_username" do
162
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_username=")
161
+      it 'has qpid_username' do
162
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_username=')
163 163
       end
164 164
 
165
-      it "has qpid_password" do
166
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_password=")
165
+      it 'has qpid_password' do
166
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_password=')
167 167
       end
168 168
 
169
-      it "has qpid_sasl_mechanisms" do
170
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_sasl_mechanisms=")
169
+      it 'has qpid_sasl_mechanisms' do
170
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_sasl_mechanisms=')
171 171
       end
172 172
 
173
-      it "has qpid_reconnect_timeout" do
174
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_timeout=0")
173
+      it 'has qpid_reconnect_timeout' do
174
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_reconnect_timeout=0')
175 175
       end
176 176
 
177
-      it "has qpid_reconnect_limit" do
178
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_limit=0")
177
+      it 'has qpid_reconnect_limit' do
178
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_reconnect_limit=0')
179 179
       end
180 180
 
181
-      it "has qpid_reconnect_interval_min" do
182
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_interval_min=0")
181
+      it 'has qpid_reconnect_interval_min' do
182
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_reconnect_interval_min=0')
183 183
       end
184 184
 
185
-      it "has qpid_reconnect_interval_max" do
186
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_interval_max=0")
185
+      it 'has qpid_reconnect_interval_max' do
186
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_reconnect_interval_max=0')
187 187
       end
188 188
 
189
-      it "has qpid_reconnect_interval" do
190
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect_interval=0")
189
+      it 'has qpid_reconnect_interval' do
190
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_reconnect_interval=0')
191 191
       end
192 192
 
193
-      it "has qpid_reconnect" do
194
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_reconnect=true")
193
+      it 'has qpid_reconnect' do
194
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_reconnect=true')
195 195
       end
196 196
 
197
-      it "has qpid_heartbeat" do
198
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_heartbeat=60")
197
+      it 'has qpid_heartbeat' do
198
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_heartbeat=60')
199 199
       end
200 200
 
201
-      it "has qpid_protocol" do
202
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_protocol=tcp")
201
+      it 'has qpid_protocol' do
202
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_protocol=tcp')
203 203
       end
204 204
 
205
-      it "has qpid_tcp_nodelay" do
206
-        expect(@chef_run).to render_file(@file.name).with_content("qpid_tcp_nodelay=true")
205
+      it 'has qpid_tcp_nodelay' do
206
+        expect(@chef_run).to render_file(@file.name).with_content('qpid_tcp_nodelay=true')
207 207
       end
208 208
     end
209 209
   end
210 210
 
211
-  describe "/var/lock/cinder" do
211
+  describe '/var/lock/cinder' do
212 212
     before do
213
-      @dir = @chef_run.directory "/var/lock/cinder"
213
+      @dir = @chef_run.directory '/var/lock/cinder'
214 214
     end
215 215
 
216
-    it "has proper owner" do
217
-      expect(@dir.owner).to eq("cinder")
218
-      expect(@dir.group).to eq("cinder")
216
+    it 'has proper owner' do
217
+      expect(@dir.owner).to eq('cinder')
218
+      expect(@dir.group).to eq('cinder')
219 219
     end
220 220
 
221
-    it "has proper modes" do
222
-      expect(sprintf("%o", @dir.mode)).to eq "700"
221
+    it 'has proper modes' do
222
+      expect(sprintf('%o', @dir.mode)).to eq '700'
223 223
     end
224 224
   end
225 225
 

+ 2
- 2
spec/default_spec.rb View File

@@ -2,7 +2,7 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::default" do
7
+describe 'openstack-block-storage::default' do
8 8
 end

+ 48
- 48
spec/identity_registration_spec.rb View File

@@ -2,85 +2,85 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::identity_registration" do
7
+describe 'openstack-block-storage::identity_registration' do
8 8
   before do
9 9
     block_storage_stubs
10 10
     @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
11
-    @chef_run.converge "openstack-block-storage::identity_registration"
11
+    @chef_run.converge 'openstack-block-storage::identity_registration'
12 12
   end
13 13
 
14
-  it "registers cinder volume service" do
14
+  it 'registers cinder volume service' do
15 15
     resource = @chef_run.find_resource(
16
-      "openstack-identity_register",
17
-      "Register Cinder Volume Service"
16
+      'openstack-identity_register',
17
+      'Register Cinder Volume Service'
18 18
     ).to_hash
19 19
 
20 20
     expect(resource).to include(
21
-      :auth_uri => "http://127.0.0.1:35357/v2.0",
22
-      :bootstrap_token => "bootstrap-token",
23
-      :service_name => "cinder",
24
-      :service_type => "volume",
25
-      :service_description => "Cinder Volume Service",
26
-      :endpoint_region => "RegionOne",
27
-      :endpoint_adminurl => "http://127.0.0.1:8776/v1/%(tenant_id)s",
28
-      :endpoint_internalurl => "http://127.0.0.1:8776/v1/%(tenant_id)s",
29
-      :endpoint_publicurl => "http://127.0.0.1:8776/v1/%(tenant_id)s",
30
-      :action => [:create_service]
21
+      auth_uri: 'http://127.0.0.1:35357/v2.0',
22
+      bootstrap_token: 'bootstrap-token',
23
+      service_name: 'cinder',
24
+      service_type: 'volume',
25
+      service_description: 'Cinder Volume Service',
26
+      endpoint_region: 'RegionOne',
27
+      endpoint_adminurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
28
+      endpoint_internalurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
29
+      endpoint_publicurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
30
+      action: [:create_service]
31 31
     )
32 32
   end
33 33
 
34
-  it "registers cinder volume endpoint" do
34
+  it 'registers cinder volume endpoint' do
35 35
     resource = @chef_run.find_resource(
36
-      "openstack-identity_register",
37
-      "Register Cinder Volume Endpoint"
36
+      'openstack-identity_register',
37
+      'Register Cinder Volume Endpoint'
38 38
     ).to_hash
39 39
 
40 40
     expect(resource).to include(
41
-      :auth_uri => "http://127.0.0.1:35357/v2.0",
42
-      :bootstrap_token => "bootstrap-token",
43
-      :service_name => "cinder",
44
-      :service_type => "volume",
45
-      :service_description => "Cinder Volume Service",
46
-      :endpoint_region => "RegionOne",
47
-      :endpoint_adminurl => "http://127.0.0.1:8776/v1/%(tenant_id)s",
48
-      :endpoint_internalurl => "http://127.0.0.1:8776/v1/%(tenant_id)s",
49
-      :endpoint_publicurl => "http://127.0.0.1:8776/v1/%(tenant_id)s",
50
-      :action => [:create_endpoint]
41
+      auth_uri: 'http://127.0.0.1:35357/v2.0',
42
+      bootstrap_token: 'bootstrap-token',
43
+      service_name: 'cinder',
44
+      service_type: 'volume',
45
+      service_description: 'Cinder Volume Service',
46
+      endpoint_region: 'RegionOne',
47
+      endpoint_adminurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
48
+      endpoint_internalurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
49
+      endpoint_publicurl: 'http://127.0.0.1:8776/v1/%(tenant_id)s',
50
+      action: [:create_endpoint]
51 51
     )
52 52
   end
53 53
 
54
-  it "registers service user" do
54
+  it 'registers service user' do
55 55
     resource = @chef_run.find_resource(
56
-      "openstack-identity_register",
57
-      "Register Cinder Service User"
56
+      'openstack-identity_register',
57
+      'Register Cinder Service User'
58 58
     ).to_hash
59 59
 
60 60
     expect(resource).to include(
61
-      :auth_uri => "http://127.0.0.1:35357/v2.0",
62
-      :bootstrap_token => "bootstrap-token",
63
-      :tenant_name => "service",
64
-      :user_name => "cinder",
65
-      :user_pass => "cinder-pass",
66
-      :user_enabled => true,
67
-      :action => [:create_user]
61
+      auth_uri: 'http://127.0.0.1:35357/v2.0',
62
+      bootstrap_token: 'bootstrap-token',
63
+      tenant_name: 'service',
64
+      user_name: 'cinder',
65
+      user_pass: 'cinder-pass',
66
+      user_enabled: true,
67
+      action: [:create_user]
68 68
     )
69 69
   end
70 70
 
71
-  it "grants admin role to service user for service tenant" do
71
+  it 'grants admin role to service user for service tenant' do
72 72
     resource = @chef_run.find_resource(
73
-      "openstack-identity_register",
74
-      "Grant service Role to Cinder Service User for Cinder Service Tenant"
73
+      'openstack-identity_register',
74
+      'Grant service Role to Cinder Service User for Cinder Service Tenant'
75 75
     ).to_hash
76 76
 
77 77
     expect(resource).to include(
78
-      :auth_uri => "http://127.0.0.1:35357/v2.0",
79
-      :bootstrap_token => "bootstrap-token",
80
-      :tenant_name => "service",
81
-      :user_name => "cinder",
82
-      :role_name => "admin",
83
-      :action => [:grant_role]
78
+      auth_uri: 'http://127.0.0.1:35357/v2.0',
79
+      bootstrap_token: 'bootstrap-token',
80
+      tenant_name: 'service',
81
+      user_name: 'cinder',
82
+      role_name: 'admin',
83
+      action: [:grant_role]
84 84
     )
85 85
   end
86 86
 end

+ 20
- 20
spec/scheduler-opensuse_spec.rb View File

@@ -2,47 +2,47 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::scheduler" do
7
+describe 'openstack-block-storage::scheduler' do
8 8
   before { block_storage_stubs }
9
-  describe "opensuse" do
9
+  describe 'opensuse' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
12
-      @chef_run.converge "openstack-block-storage::scheduler"
12
+      @chef_run.converge 'openstack-block-storage::scheduler'
13 13
     end
14 14
 
15
-    it "installs cinder scheduler packages" do
16
-      expect(@chef_run).to upgrade_package "openstack-cinder-scheduler"
15
+    it 'installs cinder scheduler packages' do
16
+      expect(@chef_run).to upgrade_package 'openstack-cinder-scheduler'
17 17
     end
18 18
 
19
-    it "does not upgrade stevedore" do
19
+    it 'does not upgrade stevedore' do
20 20
       chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
21
-      chef_run.converge "openstack-block-storage::scheduler"
21
+      chef_run.converge 'openstack-block-storage::scheduler'
22 22
 
23
-      expect(chef_run).not_to upgrade_python_pip "stevedore"
23
+      expect(chef_run).not_to upgrade_python_pip 'stevedore'
24 24
     end
25 25
 
26
-    it "installs mysql python packages by default" do
27
-      expect(@chef_run).to upgrade_package "python-mysql"
26
+    it 'installs mysql python packages by default' do
27
+      expect(@chef_run).to upgrade_package 'python-mysql'
28 28
     end
29 29
 
30
-    it "installs postgresql python packages if explicitly told" do
30
+    it 'installs postgresql python packages if explicitly told' do
31 31
       chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
32 32
       node = chef_run.node
33
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
34
-      chef_run.converge "openstack-block-storage::scheduler"
33
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
34
+      chef_run.converge 'openstack-block-storage::scheduler'
35 35
 
36
-      expect(chef_run).to upgrade_package "python-psycopg2"
37
-      expect(chef_run).not_to upgrade_package "python-mysql"
36
+      expect(chef_run).to upgrade_package 'python-psycopg2'
37
+      expect(chef_run).not_to upgrade_package 'python-mysql'
38 38
     end
39 39
 
40
-    it "starts cinder scheduler" do
41
-      expect(@chef_run).to start_service "openstack-cinder-scheduler"
40
+    it 'starts cinder scheduler' do
41
+      expect(@chef_run).to start_service 'openstack-cinder-scheduler'
42 42
     end
43 43
 
44
-    it "starts cinder scheduler on boot" do
45
-      expect(@chef_run).to enable_service "openstack-cinder-scheduler"
44
+    it 'starts cinder scheduler on boot' do
45
+      expect(@chef_run).to enable_service 'openstack-cinder-scheduler'
46 46
     end
47 47
   end
48 48
 end

+ 24
- 24
spec/scheduler-redhat_spec.rb View File

@@ -2,58 +2,58 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::scheduler" do
7
+describe 'openstack-block-storage::scheduler' do
8 8
   before { block_storage_stubs }
9
-  describe "redhat" do
9
+  describe 'redhat' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
12
-      @chef_run.converge "openstack-block-storage::scheduler"
12
+      @chef_run.converge 'openstack-block-storage::scheduler'
13 13
     end
14 14
 
15
-    it "installs cinder scheduler packages" do
16
-      expect(@chef_run).to upgrade_package "openstack-cinder"
15
+    it 'installs cinder scheduler packages' do
16
+      expect(@chef_run).to upgrade_package 'openstack-cinder'
17 17
     end
18 18
 
19
-    it "does not upgrade stevedore" do
19
+    it 'does not upgrade stevedore' do
20 20
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
21
-      chef_run.converge "openstack-block-storage::scheduler"
21
+      chef_run.converge 'openstack-block-storage::scheduler'
22 22
 
23
-      expect(chef_run).not_to upgrade_python_pip "stevedore"
23
+      expect(chef_run).not_to upgrade_python_pip 'stevedore'
24 24
     end
25 25
 
26
-    it "installs mysql python packages by default" do
27
-      expect(@chef_run).to upgrade_package "MySQL-python"
26
+    it 'installs mysql python packages by default' do
27
+      expect(@chef_run).to upgrade_package 'MySQL-python'
28 28
     end
29 29
 
30
-    it "installs db2 python packages if explicitly told" do
30
+    it 'installs db2 python packages if explicitly told' do
31 31
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
32 32
       node = chef_run.node
33
-      node.set["openstack"]["db"]["volume"]["db_type"] = "db2"
34
-      chef_run.converge "openstack-block-storage::scheduler"
33
+      node.set['openstack']['db']['volume']['db_type'] = 'db2'
34
+      chef_run.converge 'openstack-block-storage::scheduler'
35 35
 
36
-      ["db2-odbc", "python-ibm-db", "python-ibm-db-sa"].each do |pkg|
36
+      ['db2-odbc', 'python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
37 37
         expect(chef_run).to upgrade_package pkg
38 38
       end
39 39
     end
40 40
 
41
-    it "installs postgresql python packages if explicitly told" do
41
+    it 'installs postgresql python packages if explicitly told' do
42 42
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
43 43
       node = chef_run.node
44
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
45
-      chef_run.converge "openstack-block-storage::scheduler"
44
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
45
+      chef_run.converge 'openstack-block-storage::scheduler'
46 46
 
47
-      expect(chef_run).to upgrade_package "python-psycopg2"
48
-      expect(chef_run).not_to upgrade_package "MySQL-python"
47
+      expect(chef_run).to upgrade_package 'python-psycopg2'
48
+      expect(chef_run).not_to upgrade_package 'MySQL-python'
49 49
     end
50 50
 
51
-    it "starts cinder scheduler" do
52
-      expect(@chef_run).to start_service "openstack-cinder-scheduler"
51
+    it 'starts cinder scheduler' do
52
+      expect(@chef_run).to start_service 'openstack-cinder-scheduler'
53 53
     end
54 54
 
55
-    it "starts cinder scheduler on boot" do
56
-      expect(@chef_run).to enable_service "openstack-cinder-scheduler"
55
+    it 'starts cinder scheduler on boot' do
56
+      expect(@chef_run).to enable_service 'openstack-cinder-scheduler'
57 57
     end
58 58
   end
59 59
 end

+ 41
- 41
spec/scheduler_spec.rb View File

@@ -2,71 +2,71 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::scheduler" do
7
+describe 'openstack-block-storage::scheduler' do
8 8
   before { block_storage_stubs }
9
-  describe "ubuntu" do
9
+  describe 'ubuntu' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
12
-        n.set["openstack"]["block-storage"]["syslog"]["use"] = true
12
+        n.set['openstack']['block-storage']['syslog']['use'] = true
13 13
       end
14
-      @chef_run.converge "openstack-block-storage::scheduler"
14
+      @chef_run.converge 'openstack-block-storage::scheduler'
15 15
     end
16 16
 
17 17
     expect_runs_openstack_common_logging_recipe
18 18
 
19
-    it "doesn't run logging recipe" do
19
+    it 'does not run logging recipe' do
20 20
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
21
-      chef_run.converge "openstack-block-storage::scheduler"
21
+      chef_run.converge 'openstack-block-storage::scheduler'
22 22
 
23
-      expect(chef_run).not_to include_recipe "openstack-common::logging"
23
+      expect(chef_run).not_to include_recipe 'openstack-common::logging'
24 24
     end
25 25
 
26
-    it "installs cinder scheduler packages" do
27
-      expect(@chef_run).to upgrade_package "cinder-scheduler"
26
+    it 'installs cinder scheduler packages' do
27
+      expect(@chef_run).to upgrade_package 'cinder-scheduler'
28 28
     end
29 29
 
30
-    it "installs mysql python packages by default" do
31
-      expect(@chef_run).to upgrade_package "python-mysqldb"
30
+    it 'installs mysql python packages by default' do
31
+      expect(@chef_run).to upgrade_package 'python-mysqldb'
32 32
     end
33 33
 
34
-    it "installs postgresql python packages if explicitly told" do
34
+    it 'installs postgresql python packages if explicitly told' do
35 35
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
36 36
       node = chef_run.node
37
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
38
-      chef_run.converge "openstack-block-storage::scheduler"
37
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
38
+      chef_run.converge 'openstack-block-storage::scheduler'
39 39
 
40
-      expect(chef_run).to upgrade_package "python-psycopg2"
41
-      expect(chef_run).not_to upgrade_package "python-mysqldb"
40
+      expect(chef_run).to upgrade_package 'python-psycopg2'
41
+      expect(chef_run).not_to upgrade_package 'python-mysqldb'
42 42
     end
43 43
 
44
-    it "starts cinder scheduler" do
45
-      expect(@chef_run).to start_service "cinder-scheduler"
44
+    it 'starts cinder scheduler' do
45
+      expect(@chef_run).to start_service 'cinder-scheduler'
46 46
     end
47 47
 
48
-    it "starts cinder scheduler on boot" do
49
-      expect(@chef_run).to enable_service "cinder-scheduler"
48
+    it 'starts cinder scheduler on boot' do
49
+      expect(@chef_run).to enable_service 'cinder-scheduler'
50 50
     end
51 51
 
52
-    it "doesn't run logging recipe" do
53
-      expect(@chef_run).to enable_service "cinder-scheduler"
52
+    it 'does not run logging recipe' do
53
+      expect(@chef_run).to enable_service 'cinder-scheduler'
54 54
     end
55 55
 
56
-    it "doesn't setup cron when no metering" do
57
-      expect(@chef_run.cron("cinder-volume-usage-audit")).to be_nil
56
+    it 'does not setup cron when no metering' do
57
+      expect(@chef_run.cron('cinder-volume-usage-audit')).to be_nil
58 58
     end
59 59
 
60
-    it "creates cron metering default" do
60
+    it 'creates cron metering default' do
61 61
       ::Chef::Recipe.any_instance.stub(:search)
62
-        .with(:node, "roles:os-block-storage-scheduler")
63
-        .and_return([OpenStruct.new(:name => "fauxhai.local")])
62
+        .with(:node, 'roles:os-block-storage-scheduler')
63
+        .and_return([OpenStruct.new(name: 'fauxhai.local')])
64 64
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
65
-        n.set["openstack"]["metering"] = true
65
+        n.set['openstack']['metering'] = true
66 66
       end
67
-      chef_run.converge "openstack-block-storage::scheduler"
68
-      cron = chef_run.cron "cinder-volume-usage-audit"
69
-      bin_str = "/usr/bin/cinder-volume-usage-audit > /var/log/cinder/audit.log"
67
+      chef_run.converge 'openstack-block-storage::scheduler'
68
+      cron = chef_run.cron 'cinder-volume-usage-audit'
69
+      bin_str = '/usr/bin/cinder-volume-usage-audit > /var/log/cinder/audit.log'
70 70
       expect(cron.command).to match(/#{bin_str}/)
71 71
       crontests = [[:minute, '00'], [:hour, '*'], [:day, '*'],
72 72
                    [:weekday, '*'], [:month, '*'], [:user, 'cinder']]
@@ -76,27 +76,27 @@ describe "openstack-block-storage::scheduler" do
76 76
       expect(cron.action).to include :create
77 77
     end
78 78
 
79
-    it "creates cron metering custom" do
79
+    it 'creates cron metering custom' do
80 80
       crontests = [[:minute, '50'], [:hour, '23'], [:day, '6'],
81 81
                    [:weekday, '5'], [:month, '11'], [:user, 'foobar']]
82 82
       ::Chef::Recipe.any_instance.stub(:search)
83
-        .with(:node, "roles:os-block-storage-scheduler")
84
-        .and_return([OpenStruct.new(:name => "foobar")])
83
+        .with(:node, 'roles:os-block-storage-scheduler')
84
+        .and_return([OpenStruct.new(name: 'foobar')])
85 85
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
86
-        n.set["openstack"]["metering"] = true
86
+        n.set['openstack']['metering'] = true
87 87
         crontests.each do |k, v|
88
-          n.set["openstack"]["block-storage"]["cron"][k.to_s] = v
88
+          n.set['openstack']['block-storage']['cron'][k.to_s] = v
89 89
         end
90
-        n.set["openstack"]["block-storage"]["user"] = "foobar"
90
+        n.set['openstack']['block-storage']['user'] = 'foobar'
91 91
       end
92
-      chef_run.converge "openstack-block-storage::scheduler"
93
-      cron = chef_run.cron "cinder-volume-usage-audit"
92
+      chef_run.converge 'openstack-block-storage::scheduler'
93
+      cron = chef_run.cron 'cinder-volume-usage-audit'
94 94
       crontests.each do |k, v|
95 95
         expect(cron.send(k)).to eq v
96 96
       end
97 97
       expect(cron.action).to include :delete
98 98
     end
99 99
 
100
-    expect_creates_cinder_conf "service[cinder-scheduler]", "cinder", "cinder"
100
+    expect_creates_cinder_conf 'service[cinder-scheduler]', 'cinder', 'cinder'
101 101
   end
102 102
 end

+ 37
- 37
spec/spec_helper.rb View File

@@ -2,87 +2,87 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require "chefspec"
6
-require "chefspec/berkshelf"
7
-require "chef/application"
8
-require_relative "support/matcher"
5
+require 'chefspec'
6
+require 'chefspec/berkshelf'
7
+require 'chef/application'
8
+require_relative 'support/matcher'
9 9
 
10 10
 ::LOG_LEVEL = :fatal
11 11
 ::OPENSUSE_OPTS = {
12
-  :platform => "opensuse",
13
-  :version => "12.3",
14
-  :log_level => ::LOG_LEVEL
12
+  platform: 'opensuse',
13
+  version: '12.3',
14
+  log_level: ::LOG_LEVEL
15 15
 }
16 16
 ::REDHAT_OPTS = {
17
-  :platform => "redhat",
18
-  :version => "6.3",
19
-  :log_level => ::LOG_LEVEL
17
+  platform: 'redhat',
18
+  version: '6.3',
19
+  log_level: ::LOG_LEVEL
20 20
 }
21 21
 ::UBUNTU_OPTS = {
22
-  :platform => "ubuntu",
23
-  :version => "12.04",
24
-  :log_level => ::LOG_LEVEL
22
+  platform: 'ubuntu',
23
+  version: '12.04',
24
+  log_level: ::LOG_LEVEL
25 25
 }
26 26
 
27
-def block_storage_stubs
27
+def block_storage_stubs # rubocop:disable MethodLength
28 28
   ::Chef::Recipe.any_instance.stub(:rabbit_servers)
29
-    .and_return "1.1.1.1:5672,2.2.2.2:5672"
29
+    .and_return '1.1.1.1:5672,2.2.2.2:5672'
30 30
   ::Chef::Recipe.any_instance.stub(:get_password).and_return ''
31 31
   ::Chef::Recipe.any_instance.stub(:secret)
32
-    .with("secrets", "openstack_identity_bootstrap_token")
33
-    .and_return "bootstrap-token"
32
+    .with('secrets', 'openstack_identity_bootstrap_token')
33
+    .and_return 'bootstrap-token'
34 34
   ::Chef::Recipe.any_instance.stub(:get_password)
35
-    .with("user", "guest")
36
-    .and_return "rabbit-pass"
35
+    .with('user', 'guest')
36
+    .and_return 'rabbit-pass'
37 37
   ::Chef::Recipe.any_instance.stub(:get_password)
38
-    .with("service", "openstack-block-storage")
39
-    .and_return "cinder-pass"
38
+    .with('service', 'openstack-block-storage')
39
+    .and_return 'cinder-pass'
40 40
   ::Chef::Application.stub(:fatal!)
41 41
 end
42 42
 
43 43
 def expect_runs_openstack_common_logging_recipe
44
-  it "runs logging recipe if node attributes say to" do
45
-    expect(@chef_run).to include_recipe "openstack-common::logging"
44
+  it 'runs logging recipe if node attributes say to' do
45
+    expect(@chef_run).to include_recipe 'openstack-common::logging'
46 46
   end
47 47
 end
48 48
 
49
-def expect_creates_cinder_conf(service, user, group, action = :restart)
50
-  describe "cinder.conf" do
49
+def expect_creates_cinder_conf(service, user, group, action = :restart) # rubocop:disable MethodLength
50
+  describe 'cinder.conf' do
51 51
     before do
52
-      @file = @chef_run.template "/etc/cinder/cinder.conf"
52
+      @file = @chef_run.template '/etc/cinder/cinder.conf'
53 53
     end
54 54
 
55
-    it "has proper owner" do
55
+    it 'has proper owner' do
56 56
       expect(@file.owner).to eq(user)
57 57
       expect(@file.group).to eq(group)
58 58
     end
59 59
 
60
-    it "has proper modes" do
61
-      expect(sprintf("%o", @file.mode)).to eq "644"
60
+    it 'has proper modes' do
61
+      expect(sprintf('%o', @file.mode)).to eq '644'
62 62
     end
63 63
 
64
-    it "notifies service restart" do
64
+    it 'notifies service restart' do
65 65
       expect(@file).to notify(service).to(action)
66 66
     end
67 67
   end
68 68
 end
69 69
 
70
-def expect_creates_policy_json(service, user, group, action = :restart)
71
-  describe "policy.json" do
70
+def expect_creates_policy_json(service, user, group, action = :restart) # rubocop:disable MethodLength
71
+  describe 'policy.json' do
72 72
     before do
73
-      @file = @chef_run.template "/etc/cinder/policy.json"
73
+      @file = @chef_run.template '/etc/cinder/policy.json'
74 74
     end
75 75
 
76
-    it "has proper owner" do
76
+    it 'has proper owner' do
77 77
       expect(@file.owner).to eq(user)
78 78
       expect(@file.group).to eq(group)
79 79
     end
80 80
 
81
-    it "has proper modes" do
82
-      expect(sprintf("%o", @file.mode)).to eq "644"
81
+    it 'has proper modes' do
82
+      expect(sprintf('%o', @file.mode)).to eq '644'
83 83
     end
84 84
 
85
-    it "notifies service restart" do
85
+    it 'notifies service restart' do
86 86
       expect(@file).to notify(service).to(action)
87 87
     end
88 88
   end

+ 30
- 30
spec/volume-opensuse_spec.rb View File

@@ -2,66 +2,66 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::volume" do
7
+describe 'openstack-block-storage::volume' do
8 8
   before { block_storage_stubs }
9
-  describe "opensuse" do
9
+  describe 'opensuse' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
12
-      @chef_run.converge "openstack-block-storage::volume"
12
+      @chef_run.converge 'openstack-block-storage::volume'
13 13
     end
14 14
 
15
-    it "installs cinder volume packages" do
16
-      expect(@chef_run).to upgrade_package "openstack-cinder-volume"
15
+    it 'installs cinder volume packages' do
16
+      expect(@chef_run).to upgrade_package 'openstack-cinder-volume'
17 17
     end
18 18
 
19
-    it "installs mysql python packages by default" do
20
-      expect(@chef_run).to upgrade_package "python-mysql"
19
+    it 'installs mysql python packages by default' do
20
+      expect(@chef_run).to upgrade_package 'python-mysql'
21 21
     end
22 22
 
23
-    it "installs postgresql python packages if explicitly told" do
23
+    it 'installs postgresql python packages if explicitly told' do
24 24
       chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS
25 25
       node = chef_run.node
26
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
27
-      chef_run.converge "openstack-block-storage::volume"
26
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
27
+      chef_run.converge 'openstack-block-storage::volume'
28 28
 
29
-      expect(chef_run).to upgrade_package "python-psycopg2"
30
-      expect(chef_run).not_to upgrade_package "python-mysql"
29
+      expect(chef_run).to upgrade_package 'python-psycopg2'
30
+      expect(chef_run).not_to upgrade_package 'python-mysql'
31 31
     end
32 32
 
33
-    it "installs cinder iscsi packages" do
34
-      expect(@chef_run).to upgrade_package "tgt"
33
+    it 'installs cinder iscsi packages' do
34
+      expect(@chef_run).to upgrade_package 'tgt'
35 35
     end
36 36
 
37
-    it "starts cinder volume" do
38
-      expect(@chef_run).to start_service "openstack-cinder-volume"
37
+    it 'starts cinder volume' do
38
+      expect(@chef_run).to start_service 'openstack-cinder-volume'
39 39
     end
40 40
 
41
-    it "starts cinder volume on boot" do
42
-      expected = "openstack-cinder-volume"
41
+    it 'starts cinder volume on boot' do
42
+      expected = 'openstack-cinder-volume'
43 43
       expect(@chef_run).to enable_service expected
44 44
     end
45 45
 
46
-    it "starts iscsi target on boot" do
47
-      expect(@chef_run).to enable_service "tgtd"
46
+    it 'starts iscsi target on boot' do
47
+      expect(@chef_run).to enable_service 'tgtd'
48 48
     end
49 49
 
50
-    it "installs nfs packages" do
50
+    it 'installs nfs packages' do
51 51
       chef_run = ::ChefSpec::Runner.new ::OPENSUSE_OPTS do |n|
52
-        n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver"
52
+        n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
53 53
       end
54
-      chef_run.converge "openstack-block-storage::volume"
54
+      chef_run.converge 'openstack-block-storage::volume'
55 55
 
56
-      expect(chef_run).to upgrade_package "nfs-utils"
57
-      expect(chef_run).not_to upgrade_package "nfs-utils-lib"
56
+      expect(chef_run).to upgrade_package 'nfs-utils'
57
+      expect(chef_run).not_to upgrade_package 'nfs-utils-lib'
58 58
     end
59 59
 
60
-    it "has opensuse include" do
61
-      file = "/etc/tgt/targets.conf"
60
+    it 'has opensuse include' do
61
+      file = '/etc/tgt/targets.conf'
62 62
 
63
-      expect(@chef_run).to render_file(file).with_content("include /var/lib/cinder/volumes/*")
64
-      expect(@chef_run).not_to render_file(file).with_content("include /etc/tgt/conf.d/*.conf")
63
+      expect(@chef_run).to render_file(file).with_content('include /var/lib/cinder/volumes/*')
64
+      expect(@chef_run).not_to render_file(file).with_content('include /etc/tgt/conf.d/*.conf')
65 65
     end
66 66
   end
67 67
 end

+ 32
- 32
spec/volume-redhat_spec.rb View File

@@ -2,73 +2,73 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::volume" do
7
+describe 'openstack-block-storage::volume' do
8 8
   before { block_storage_stubs }
9
-  describe "redhat" do
9
+  describe 'redhat' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
12
-      @chef_run.converge "openstack-block-storage::volume"
12
+      @chef_run.converge 'openstack-block-storage::volume'
13 13
     end
14 14
 
15
-    it "installs mysql python packages by default" do
16
-      expect(@chef_run).to upgrade_package "MySQL-python"
15
+    it 'installs mysql python packages by default' do
16
+      expect(@chef_run).to upgrade_package 'MySQL-python'
17 17
     end
18 18
 
19
-    it "installs db2 python packages if explicitly told" do
19
+    it 'installs db2 python packages if explicitly told' do
20 20
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
21 21
       node = chef_run.node
22
-      node.set["openstack"]["db"]["volume"]["db_type"] = "db2"
23
-      chef_run.converge "openstack-block-storage::volume"
22
+      node.set['openstack']['db']['volume']['db_type'] = 'db2'
23
+      chef_run.converge 'openstack-block-storage::volume'
24 24
 
25
-      ["db2-odbc", "python-ibm-db", "python-ibm-db-sa"].each do |pkg|
25
+      ['db2-odbc', 'python-ibm-db', 'python-ibm-db-sa'].each do |pkg|
26 26
         expect(chef_run).to upgrade_package pkg
27 27
       end
28 28
     end
29 29
 
30
-    it "installs postgresql python packages if explicitly told" do
30
+    it 'installs postgresql python packages if explicitly told' do
31 31
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS
32 32
       node = chef_run.node
33
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
34
-      chef_run.converge "openstack-block-storage::volume"
33
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
34
+      chef_run.converge 'openstack-block-storage::volume'
35 35
 
36
-      expect(chef_run).to upgrade_package "python-psycopg2"
37
-      expect(chef_run).not_to upgrade_package "MySQL-python"
36
+      expect(chef_run).to upgrade_package 'python-psycopg2'
37
+      expect(chef_run).not_to upgrade_package 'MySQL-python'
38 38
     end
39 39
 
40
-    it "installs cinder iscsi packages" do
41
-      expect(@chef_run).to upgrade_package "scsi-target-utils"
40
+    it 'installs cinder iscsi packages' do
41
+      expect(@chef_run).to upgrade_package 'scsi-target-utils'
42 42
     end
43 43
 
44
-    it "starts cinder volume" do
45
-      expect(@chef_run).to start_service "openstack-cinder-volume"
44
+    it 'starts cinder volume' do
45
+      expect(@chef_run).to start_service 'openstack-cinder-volume'
46 46
     end
47 47
 
48
-    it "starts cinder volume on boot" do
49
-      expected = "openstack-cinder-volume"
48
+    it 'starts cinder volume on boot' do
49
+      expected = 'openstack-cinder-volume'
50 50
       expect(@chef_run).to enable_service expected
51 51
     end
52 52
 
53
-    it "starts iscsi target on boot" do
54
-      expect(@chef_run).to enable_service "tgtd"
53
+    it 'starts iscsi target on boot' do
54
+      expect(@chef_run).to enable_service 'tgtd'
55 55
     end
56 56
 
57
-    it "installs nfs packages" do
57
+    it 'installs nfs packages' do
58 58
       chef_run = ::ChefSpec::Runner.new ::REDHAT_OPTS do |n|
59
-        n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver"
59
+        n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
60 60
       end
61
-      chef_run.converge "openstack-block-storage::volume"
61
+      chef_run.converge 'openstack-block-storage::volume'
62 62
 
63
-      expect(chef_run).to upgrade_package "nfs-utils"
64
-      expect(chef_run).to upgrade_package "nfs-utils-lib"
63
+      expect(chef_run).to upgrade_package 'nfs-utils'
64
+      expect(chef_run).to upgrade_package 'nfs-utils-lib'
65 65
     end
66 66
 
67
-    it "has redhat include" do
68
-      file = "/etc/tgt/targets.conf"
67
+    it 'has redhat include' do
68
+      file = '/etc/tgt/targets.conf'
69 69
 
70
-      expect(@chef_run).to render_file(file).with_content("include /var/lib/cinder/volumes/*")
71
-      expect(@chef_run).not_to render_file(file).with_content("include /etc/tgt/conf.d/*.conf")
70
+      expect(@chef_run).to render_file(file).with_content('include /var/lib/cinder/volumes/*')
71
+      expect(@chef_run).not_to render_file(file).with_content('include /etc/tgt/conf.d/*.conf')
72 72
     end
73 73
   end
74 74
 end

+ 88
- 88
spec/volume_spec.rb View File

@@ -2,189 +2,189 @@
2 2
 #
3 3
 # Cookbook Name:: openstack-block-storage
4 4
 
5
-require_relative "spec_helper"
5
+require_relative 'spec_helper'
6 6
 
7
-describe "openstack-block-storage::volume" do
7
+describe 'openstack-block-storage::volume' do
8 8
   before { block_storage_stubs }
9
-  describe "ubuntu" do
9
+  describe 'ubuntu' do
10 10
     before do
11 11
       @chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
12
-        n.set["openstack"]["block-storage"]["syslog"]["use"] = true
12
+        n.set['openstack']['block-storage']['syslog']['use'] = true
13 13
       end
14
-      @chef_run.converge "openstack-block-storage::volume"
14
+      @chef_run.converge 'openstack-block-storage::volume'
15 15
     end
16 16
 
17 17
     expect_runs_openstack_common_logging_recipe
18 18
 
19
-    it "doesn't run logging recipe" do
19
+    it 'does not run logging recipe' do
20 20
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
21
-      chef_run.converge "openstack-block-storage::volume"
21
+      chef_run.converge 'openstack-block-storage::volume'
22 22
 
23
-      expect(chef_run).not_to include_recipe "openstack-common::logging"
23
+      expect(chef_run).not_to include_recipe 'openstack-common::logging'
24 24
     end
25 25
 
26
-    it "installs cinder volume packages" do
27
-      expect(@chef_run).to upgrade_package "cinder-volume"
26
+    it 'installs cinder volume packages' do
27
+      expect(@chef_run).to upgrade_package 'cinder-volume'
28 28
     end
29 29
 
30
-    it "installs mysql python packages by default" do
31
-      expect(@chef_run).to upgrade_package "python-mysqldb"
30
+    it 'installs mysql python packages by default' do
31
+      expect(@chef_run).to upgrade_package 'python-mysqldb'
32 32
     end
33 33
 
34
-    it "installs postgresql python packages if explicitly told" do
34
+    it 'installs postgresql python packages if explicitly told' do
35 35
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS
36 36
       node = chef_run.node
37
-      node.set["openstack"]["db"]["volume"]["db_type"] = "postgresql"
38
-      chef_run.converge "openstack-block-storage::volume"
37
+      node.set['openstack']['db']['volume']['db_type'] = 'postgresql'
38
+      chef_run.converge 'openstack-block-storage::volume'
39 39
 
40
-      expect(chef_run).to upgrade_package "python-psycopg2"
41
-      expect(chef_run).not_to upgrade_package "python-mysqldb"
40
+      expect(chef_run).to upgrade_package 'python-psycopg2'
41
+      expect(chef_run).not_to upgrade_package 'python-mysqldb'
42 42
     end
43 43
 
44
-    it "installs cinder iscsi packages" do
45
-      expect(@chef_run).to upgrade_package "tgt"
44
+    it 'installs cinder iscsi packages' do
45
+      expect(@chef_run).to upgrade_package 'tgt'
46 46
     end
47 47
 
48
-    it "installs nfs packages" do
48
+    it 'installs nfs packages' do
49 49
       chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
50
-        n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver"
50
+        n.set['openstack']['block-storage']['volume']['driver'] = 'cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver'
51 51
       end
52
-      chef_run.converge "openstack-block-storage::volume"
52
+      chef_run.converge 'openstack-block-storage::volume'
53 53
 
54
-      expect(chef_run).to upgrade_package "nfs-common"
54
+      expect(chef_run).to upgrade_package 'nfs-common'
55 55
     end
56 56