Browse Source

Initial network Pike updates

- Switched default linter to cookstyle
- Renamed rake tasks to better conform with Chef conventions

Change-Id: I5dd1971392fdf282d0f214dfce9dcbecc18542a8
Samuel Cassiba 1 year ago
parent
commit
9de60304f4

+ 0
- 2
.rubocop.yml View File

@@ -1,5 +1,3 @@
1
-inherit_from: .rubocop_todo.yml
2
-
3 1
 AllCops:
4 2
   Include:
5 3
     - metadata.rb

+ 0
- 27
.rubocop_todo.yml View File

@@ -1,27 +0,0 @@
1
-# This configuration was generated by
2
-# `rubocop --auto-gen-config`
3
-# on 2017-08-17 14:16:15 +0200 using RuboCop version 0.47.1.
4
-# The point is for the user to remove these configuration records
5
-# one by one as the offenses are removed from the code base.
6
-# Note that changes in the inspected code, or installation of new
7
-# versions of RuboCop, may require this file to be generated again.
8
-
9
-# Offense count: 42
10
-# Configuration parameters: CountComments, ExcludedMethods.
11
-Metrics/BlockLength:
12
-  Max: 122
13
-
14
-# Offense count: 9
15
-# Configuration parameters: EnforcedStyle, SupportedStyles.
16
-# SupportedStyles: nested, compact
17
-Style/ClassAndModuleChildren:
18
-  Exclude:
19
-    - 'recipes/_bridge_config_example.rb'
20
-    - 'recipes/default.rb'
21
-    - 'recipes/fwaas.rb'
22
-    - 'recipes/identity_registration.rb'
23
-    - 'recipes/l3_agent.rb'
24
-    - 'recipes/lbaas.rb'
25
-    - 'recipes/ml2_openvswitch.rb'
26
-    - 'recipes/server.rb'
27
-    - 'recipes/vpnaas.rb'

+ 7
- 7
Rakefile View File

@@ -1,20 +1,20 @@
1 1
 task default: ["test"]
2 2
 
3
-task :test => [:lint, :style, :unit]
3
+task :test => [:syntax, :lint, :unit]
4 4
 
5 5
 desc "Vendor the cookbooks in the Berksfile"
6 6
 task :berks_prep do
7 7
   sh %{chef exec berks vendor}
8 8
 end
9 9
 
10
-desc "Run FoodCritic (lint) tests"
11
-task :lint do
12
-  sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
10
+desc "Run FoodCritic (syntax) tests"
11
+task :syntax do
12
+  sh %{chef exec foodcritic --exclude spec -f any .}
13 13
 end
14 14
 
15
-desc "Run RuboCop (style) tests"
16
-task :style do
17
-  sh %{chef exec rubocop}
15
+desc "Run RuboCop (lint) tests"
16
+task :lint do
17
+  sh %{chef exec cookstyle}
18 18
 end
19 19
 
20 20
 desc "Run RSpec (unit) tests"

+ 1
- 1
recipes/dhcp_agent.rb View File

@@ -67,6 +67,6 @@ service 'neutron-dhcp-agent' do
67 67
     'template[/etc/neutron/neutron.conf]',
68 68
     'template [/etc/neutron/dnsmasq.conf]',
69 69
     "template[#{node['openstack']['network_dhcp']['config_file']}]",
70
-    'rpm_package[dnsmasq]'
70
+    'rpm_package[dnsmasq]',
71 71
   ]
72 72
 end

+ 2
- 2
recipes/identity_registration.rb View File

@@ -33,7 +33,7 @@ auth_url = ::URI.decode identity_admin_endpoint.to_s
33 33
 interfaces = {
34 34
   public: { url: public_endpoint('network') },
35 35
   internal: { url: internal_endpoint('network') },
36
-  admin: { url: admin_endpoint('network') }
36
+  admin: { url: admin_endpoint('network') },
37 37
 }
38 38
 
39 39
 service_pass = get_password 'service', 'openstack-network'
@@ -58,7 +58,7 @@ connection_params = {
58 58
   openstack_username:     admin_user,
59 59
   openstack_api_key:      admin_pass,
60 60
   openstack_project_name: admin_project,
61
-  openstack_domain_name:    admin_domain
61
+  openstack_domain_name:    admin_domain,
62 62
 }
63 63
 
64 64
 # Register Network Service

+ 1
- 1
recipes/l3_agent.rb View File

@@ -64,7 +64,7 @@ service 'neutron-l3-agent' do
64 64
     action [:enable, :start]
65 65
     subscribes :restart, [
66 66
       'template[/etc/neutron/neutron.conf]',
67
-      "template[#{node['openstack']['network_fwaas']['config_file']}]"
67
+      "template[#{node['openstack']['network_fwaas']['config_file']}]",
68 68
     ]
69 69
   end
70 70
 end

+ 1
- 1
recipes/metadata_agent.rb View File

@@ -65,6 +65,6 @@ service 'neutron-metadata-agent' do
65 65
   action [:enable, :start]
66 66
   subscribes :restart, [
67 67
     'template[/etc/neutron/neutron.conf]',
68
-    "template[#{node['openstack']['network_metadata']['config_file']}]"
68
+    "template[#{node['openstack']['network_metadata']['config_file']}]",
69 69
   ]
70 70
 end

+ 1
- 1
recipes/metering_agent.rb View File

@@ -46,6 +46,6 @@ service 'neutron-metering-agent' do
46 46
   action [:enable, :start]
47 47
   subscribes :restart, [
48 48
     'template[/etc/neutron/neutron.conf]',
49
-    "template[#{node['openstack']['network_metering']['config_file']}]"
49
+    "template[#{node['openstack']['network_metering']['config_file']}]",
50 50
   ]
51 51
 end

+ 1
- 1
recipes/openvswitch_agent.rb View File

@@ -45,6 +45,6 @@ service 'neutron-openvswitch-agent' do
45 45
   action [:enable, :start]
46 46
   subscribes :restart, [
47 47
     'template[/etc/neutron/neutron.conf]',
48
-    "template[#{plugin_file_path}]"
48
+    "template[#{plugin_file_path}]",
49 49
   ]
50 50
 end

+ 1
- 1
recipes/server.rb View File

@@ -103,7 +103,7 @@ service 'neutron-server' do
103 103
   subscribes :restart, [
104 104
     plugin_templates,
105 105
     'template[/etc/neutron/neutron.conf]',
106
-    'remote_file[/etc/neutron/policy.json]'
106
+    'remote_file[/etc/neutron/policy.json]',
107 107
   ].flatten
108 108
 end
109 109
 

+ 1
- 1
recipes/vpnaas.rb View File

@@ -69,6 +69,6 @@ service 'neutron-vpn-agent' do
69 69
   subscribes :restart, [
70 70
     'template[/etc/neutron/neutron.conf]',
71 71
     "template[#{node['openstack']['network_vpnaas']['config_file']}]",
72
-    "template[#{node['openstack']['network_fwaas']['config_file']}]"
72
+    "template[#{node['openstack']['network_fwaas']['config_file']}]",
73 73
   ]
74 74
 end

+ 6
- 6
spec/default_spec.rb View File

@@ -55,7 +55,7 @@ describe 'openstack-network' do
55 55
         %r{^exec_dirs = /sbin,/usr/sbin,/bin,/usr/bin$},
56 56
         /^use_syslog = false$/,
57 57
         /^syslog_log_facility = syslog$/,
58
-        /^syslog_log_level = ERROR$/
58
+        /^syslog_log_level = ERROR$/,
59 59
       ].each do |line|
60 60
         it do
61 61
           expect(chef_run).to render_config_file(file.name)
@@ -72,7 +72,7 @@ describe 'openstack-network' do
72 72
         /^core_plugin = ml2$/,
73 73
         %r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
74 74
         /^bind_host = 127\.0\.0\.1$/,
75
-        /^bind_port = 9696$/
75
+        /^bind_port = 9696$/,
76 76
       ].each do |line|
77 77
         it do
78 78
           expect(chef_run).to render_config_file(file.name)
@@ -80,7 +80,7 @@ describe 'openstack-network' do
80 80
         end
81 81
       end
82 82
       [
83
-        %r{^root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf$}
83
+        %r{^root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf$},
84 84
       ].each do |line|
85 85
         it do
86 86
           expect(chef_run).to render_config_file(file.name)
@@ -94,7 +94,7 @@ describe 'openstack-network' do
94 94
         /^project_domain_name = Default/,
95 95
         %r{^auth_url = http://127\.0\.0\.1:5000/v3$},
96 96
         /^password = neutron-pass$/,
97
-        /^auth_type = v3password$/
97
+        /^auth_type = v3password$/,
98 98
       ].each do |line|
99 99
         it do
100 100
           expect(chef_run).to render_config_file(file.name)
@@ -108,7 +108,7 @@ describe 'openstack-network' do
108 108
         /^username = nova$/,
109 109
         /^user_domain_name = Default/,
110 110
         /^project_domain_name = Default/,
111
-        /^project_name = service$/
111
+        /^project_name = service$/,
112 112
       ].each do |line|
113 113
         it do
114 114
           expect(chef_run).to render_config_file(file.name)
@@ -116,7 +116,7 @@ describe 'openstack-network' do
116 116
         end
117 117
       end
118 118
       [
119
-        %(connection = mysql+pymysql://neutron:neutron@127.0.0.1:3306/neutron?charset=utf8)
119
+        %(connection = mysql+pymysql://neutron:neutron@127.0.0.1:3306/neutron?charset=utf8),
120 120
       ].each do |line|
121 121
         it do
122 122
           expect(chef_run).to render_config_file(file.name)

+ 1
- 1
spec/identity_registration_spec.rb View File

@@ -18,7 +18,7 @@ describe 'openstack-network::identity_registration' do
18 18
       openstack_username: 'admin',
19 19
       openstack_api_key: 'admin-pass',
20 20
       openstack_project_name: 'admin',
21
-      openstack_domain_name: 'default'
21
+      openstack_domain_name: 'default',
22 22
     }
23 23
     service_name = 'neutron'
24 24
     service_type = 'network'

+ 1
- 1
spec/lbaas_spec.rb View File

@@ -33,7 +33,7 @@ describe 'openstack-network::lbaas' do
33 33
           /^periodic_interval = 10$/,
34 34
           /^ovs_use_veth = false$/,
35 35
           /^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
36
-          /^device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver$/
36
+          /^device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver$/,
37 37
         ].each do |line|
38 38
           expect(chef_run).to render_file(file.name).with_content(line)
39 39
         end

+ 1
- 1
spec/metering_agent_spec.rb View File

@@ -31,7 +31,7 @@ describe 'openstack-network::metering_agent' do
31 31
       it do
32 32
         [
33 33
           /^interface_driver = neutron.agent.linux.interface.OVSInterfaceDriver$/,
34
-          /^driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver$/
34
+          /^driver = neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver$/,
35 35
         ].each do |line|
36 36
           expect(chef_run).to render_file(file.name).with_content(line)
37 37
         end

+ 1
- 1
spec/ml2_linuxbridge-redhat_spec.rb View File

@@ -37,7 +37,7 @@ describe 'openstack-network::ml2_linuxbridge' do
37 37
         chef_run.template('/etc/neutron/plugins/ml2/linuxbridge_agent.ini')
38 38
       end
39 39
       [
40
-        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
40
+        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
41 41
       ].each do |line|
42 42
         it do
43 43
           expect(chef_run).to render_config_file(file.name)

+ 1
- 1
spec/ml2_linuxbridge_spec.rb View File

@@ -38,7 +38,7 @@ describe 'openstack-network::ml2_linuxbridge' do
38 38
         chef_run.template('/etc/neutron/plugins/linuxbridge/linuxbridge_conf.ini')
39 39
       end
40 40
       [
41
-        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/
41
+        /^firewall_driver = neutron.agent.linux.iptables_firewall.IptablesFirewallDriver$/,
42 42
       ].each do |line|
43 43
         it do
44 44
           expect(chef_run).to render_config_file(file.name)

+ 1
- 1
spec/server_spec.rb View File

@@ -102,7 +102,7 @@ describe 'openstack-network::server' do
102 102
             %r{^exec_dirs = /sbin,/usr/sbin,/bin,/usr/bin$},
103 103
             /^use_syslog = false$/,
104 104
             /^syslog_log_facility = syslog$/,
105
-            /^syslog_log_level = ERROR$/
105
+            /^syslog_log_level = ERROR$/,
106 106
           ].each do |line|
107 107
             expect(chef_run).to render_file(file.name).with_content(line)
108 108
           end

+ 3
- 3
spec/spec_helper.rb View File

@@ -11,17 +11,17 @@ LOG_LEVEL = :fatal
11 11
 REDHAT_OPTS = {
12 12
   platform: 'redhat',
13 13
   version: '7.1',
14
-  log_level: LOG_LEVEL
14
+  log_level: LOG_LEVEL,
15 15
 }.freeze
16 16
 UBUNTU_OPTS = {
17 17
   platform: 'ubuntu',
18 18
   version: '16.04',
19
-  log_level: LOG_LEVEL
19
+  log_level: LOG_LEVEL,
20 20
 }.freeze
21 21
 CENTOS_OPTS = {
22 22
   platform: 'centos',
23 23
   version: '7.2.1511',
24
-  log_level: LOG_LEVEL
24
+  log_level: LOG_LEVEL,
25 25
 }.freeze
26 26
 
27 27
 shared_context 'neutron-stubs' do

Loading…
Cancel
Save