Cleanup minor rubocop offenses

Cleaned up all the minor rubocop issues, the ones left relate to
complex logic and what I think is a bug in rubocop for nested
vs compact modules/class definitions.

Change-Id: I6451b7593f36287d4efe4d7542f97d0a090fb1d1
This commit is contained in:
Mark Vanderwiel 2015-05-29 10:49:00 -05:00
parent 38758fbb14
commit 095db20713
26 changed files with 94 additions and 155 deletions

View File

@ -1,61 +1,11 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-02-27 13:48:00 -0600 using RuboCop version 0.29.1.
# on 2015-05-29 10:47:45 -0500 using RuboCop version 0.29.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 2
# Cop supports --auto-correct.
Lint/DeprecatedClassMethods:
Enabled: false
# Offense count: 4
# Cop supports --auto-correct.
Lint/UnusedBlockArgument:
Enabled: false
# Offense count: 6
# Offense count: 8
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/EmptyLinesAroundBlockBody:
Enabled: false
# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/FirstParameterIndentation:
Enabled: false
# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/IndentHash:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Style/MultilineBlockLayout:
Enabled: false
# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/MultilineOperationIndentation:
Enabled: false
# Offense count: 19
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false
# Offense count: 21
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false

View File

@ -173,9 +173,9 @@ default['openstack']['network']['interface_driver'] = 'neutron.agent.linux.inter
# Maps the above core plugin driver to a simple name
# This is used in the neutron_plugin_package package name and common recipe case statements
default['openstack']['network']['core_plugin_map'] = {
'ovsneutronpluginv2' => 'openvswitch',
'linuxbridgepluginv2' => 'linuxbridge',
'ml2plugin' => 'ml2'
'ovsneutronpluginv2' => 'openvswitch',
'linuxbridgepluginv2' => 'linuxbridge',
'ml2plugin' => 'ml2'
}
# This is used by SUSE to setup the sysconfig neutron initfile

View File

@ -1,21 +1,21 @@
# Encoding: utf-8
name 'openstack-network'
maintainer 'openstack-chef'
name 'openstack-network'
maintainer 'openstack-chef'
maintainer_email 'opscode-chef-openstack@googlegroups.com'
license 'Apache 2.0'
description 'Installs and configures the OpenStack Network API Service and various agents and plugins'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
recipe 'openstack-network::client', 'Install packages required for network client'
recipe 'openstack-network::server', 'Installs packages required for a OpenStack Network server'
recipe 'openstack-network::openvswitch', 'Installs packages required for OVS'
recipe 'openstack-network::metadata_agent', 'Installs packages required for a OpenStack Network Metadata Agent'
recipe 'openstack-network::identity_registration', 'Registers OpenStack Network endpoints and service user with Keystone'
recipe 'openstack-network::vpn_agent', 'Installs packages required for Network VPN Agent'
license 'Apache 2.0'
description 'Installs and configures the OpenStack Network API Service and various agents and plugins'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
recipe 'openstack-network::client', 'Install packages required for network client'
recipe 'openstack-network::server', 'Installs packages required for a OpenStack Network server'
recipe 'openstack-network::openvswitch', 'Installs packages required for OVS'
recipe 'openstack-network::metadata_agent', 'Installs packages required for a OpenStack Network Metadata Agent'
recipe 'openstack-network::identity_registration', 'Registers OpenStack Network endpoints and service user with Keystone'
recipe 'openstack-network::vpn_agent', 'Installs packages required for Network VPN Agent'
%w{ ubuntu fedora redhat centos suse }.each do |os|
%w(ubuntu fedora redhat centos suse).each do |os|
supports os
end
depends 'openstack-common', '>= 11.2.0'
depends 'openstack-identity', '>= 11.0.0'
depends 'openstack-common', '>= 11.2.0'
depends 'openstack-identity', '>= 11.0.0'

View File

@ -39,7 +39,7 @@ remote_file src_filepath do
owner 'root'
group 'root'
mode 00644
not_if { ::File.exists?("#{Chef::Config['file_cache_path']}/#{ovs_options['openvswitch_filename']}") }
not_if { ::File.exist?("#{Chef::Config['file_cache_path']}/#{ovs_options['openvswitch_filename']}") }
end
bash 'disable_openvswitch_before_upgrade' do

View File

@ -183,7 +183,7 @@ template '/etc/neutron/neutron.conf' do
source 'neutron.conf.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00640
mode 00640
variables(
bind_address: network_api_bind.host,
bind_port: network_api_bind.port,
@ -439,7 +439,7 @@ link '/etc/neutron/plugin.ini' do
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
action :create
only_if { platform_family? %w{fedora rhel} }
only_if { platform_family? %w(fedora rhel) }
end
node.set['openstack']['network']['plugin_config_file'] = template_file
@ -454,6 +454,6 @@ template '/etc/default/neutron-server' do
)
only_if do
node.run_list.expand(node.chef_environment).recipes.include?('openstack-network::server')
platform_family?(%w{debian})
platform_family?('debian')
end
end

View File

@ -54,7 +54,7 @@ template '/etc/neutron/dnsmasq.conf' do
source 'dnsmasq.conf.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00644
mode 00644
notifies :restart, 'service[neutron-dhcp-agent]', :delayed
end
@ -62,7 +62,7 @@ template '/etc/neutron/dhcp_agent.ini' do
source 'dhcp_agent.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00644
mode 00644
notifies :restart, 'service[neutron-dhcp-agent]', :immediately
end
@ -74,7 +74,7 @@ when 'centos'
remote_file dnsmasq_file do
source node['openstack']['network']['dhcp']['dnsmasq_rpm_source']
not_if { ::File.exists?(dnsmasq_file) || node['openstack']['network']['dhcp']['dnsmasq_rpm_version'].to_s.empty? }
not_if { ::File.exist?(dnsmasq_file) || node['openstack']['network']['dhcp']['dnsmasq_rpm_version'].to_s.empty? }
end
rpm_package 'dnsmasq' do

View File

@ -45,8 +45,8 @@ ruby_block 'query gateway external network uuid' do
end
action :run
only_if do
node['openstack']['network']['l3']['gateway_external_network_id'].nil? &&
node['openstack']['network']['l3']['gateway_external_network_name']
(node['openstack']['network']['l3']['gateway_external_network_id'].nil? &&
node['openstack']['network']['l3']['gateway_external_network_name'])
end
end
@ -90,7 +90,7 @@ template '/etc/neutron/l3_agent.ini' do
source 'l3_agent.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00640
mode 00640
variables(
agent_mode: agent_mode
)

View File

@ -40,7 +40,7 @@ template '/etc/neutron/metadata_agent.ini' do
source 'metadata_agent.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00644
mode 00644
variables(
identity_endpoint: identity_endpoint,
metadata_secret: metadata_secret,

View File

@ -70,6 +70,6 @@ template node['openstack']['network']['vpn']['config_file'] do
source 'services/neutron-vpnaas/vpn_agent.ini.erb'
owner node['openstack']['network']['platform']['user']
group node['openstack']['network']['platform']['group']
mode 00640
mode 00640
notifies :restart, 'service[neutron-vpn-agent]', :immediately
end

View File

@ -86,7 +86,5 @@ describe 'openstack-network::balancer' do
expect(file).to notify('service[neutron-lb-agent]').to(:restart).delayed
end
end
end
end

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::db_migration' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
@ -28,40 +27,40 @@ describe 'openstack-network::db_migration' do
it 'uses db upgrade head when vpnaas is enabled' do
node.set['openstack']['network']['enable_vpn'] = true
migrate_cmd = %r(neutron-db-manage --service vpnaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head)
migrate_cmd = %r{neutron-db-manage --service vpnaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head}
expect(chef_run).to run_bash('migrate vpnaas database').with(code: migrate_cmd)
end
it 'does not use db upgrade head when vpnaas is not enabled' do
migrate_cmd = %r(neutron-db-manage --service vpnaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head)
migrate_cmd = %r{neutron-db-manage --service vpnaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head}
expect(chef_run).not_to run_bash('migrate vpnaas database').with(code: migrate_cmd)
end
it 'uses db upgrade head when fwaas is enabled' do
node.set['openstack']['network']['fwaas']['enabled'] = 'True'
migrate_cmd = %r(neutron-db-manage --service fwaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head)
migrate_cmd = %r{neutron-db-manage --service fwaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head}
expect(chef_run).to run_bash('migrate fwaas database').with(code: migrate_cmd)
end
it 'does not use db upgrade head when fwaas is not enabled' do
migrate_cmd = %r(neutron-db-manage --service fwaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head)
migrate_cmd = %r{neutron-db-manage --service fwaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head}
expect(chef_run).not_to run_bash('migrate fwaas database').with(code: migrate_cmd)
end
it 'uses db upgrade head when lbaas is enabled' do
node.set['openstack']['network']['lbaas']['enabled'] = 'True'
migrate_cmd = %r(neutron-db-manage --service lbaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head)
migrate_cmd = %r{neutron-db-manage --service lbaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head}
expect(chef_run).to run_bash('migrate lbaas database').with(code: migrate_cmd)
end
it 'does not use db upgrade head when lbaas is not enabled' do
migrate_cmd = %r(neutron-db-manage --service lbaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head)
migrate_cmd = %r{neutron-db-manage --service lbaas --config-file /etc/neutron/neutron.conf|
--config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head}
expect(chef_run).not_to run_bash('migrate lbaas database').with(code: migrate_cmd)
end
end

View File

@ -30,10 +30,10 @@ describe 'openstack-network' do
it 'create plugin.ini symlink' do
expect(chef_run).to create_link('/etc/neutron/plugin.ini').with(
to: file.name,
owner: 'neutron',
group: 'neutron'
)
to: file.name,
owner: 'neutron',
group: 'neutron'
)
end
it 'does not include the ovs section' do
expect(chef_run).not_to render_file(file.name).with_content(/^[OVS]/)

View File

@ -54,7 +54,7 @@ describe 'openstack-network' do
context 'plugins' do
before do
PLUGIN_MAP.each do |key, value|
PLUGIN_MAP.each do |key, _value|
node.set['openstack']['network']['core_plugin_map'][key] = key
end
end
@ -122,7 +122,8 @@ describe 'openstack-network' do
end
describe 'cisco' do
let(:nexus_switch_value) do {
let(:nexus_switch_value) do
{
'ip0' => { 'hosts' => ['host_info00', 'host_info01'],
'ssh_port' => 'ssh_port0',
'username' => 'username0',
@ -157,13 +158,13 @@ describe 'openstack-network' do
context 'nexus_switch' do
it 'shows the ip' do
nexus_switch_value.each do |ip, info|
nexus_switch_value.each do |ip, _info|
expect(chef_run).to render_file(file.name).with_content(/^\[NEXUS_SWITCH:#{ip}\]$/)
end
end
it 'shows the host_info' do
nexus_switch_value.each do |ip, info|
nexus_switch_value.each do |_ip, info|
info['hosts'].each do |host_info|
expect(chef_run).to render_file(file.name).with_content(/^#{host_info[0]} = #{host_info[1]}$/)
end
@ -172,7 +173,7 @@ describe 'openstack-network' do
%w(ssh_port username password).each do |attr|
it "shows the #{attr}" do
nexus_switch_value.each do |ip, info|
nexus_switch_value.each do |_ip, info|
expect(chef_run).to render_file(file.name).with_content(/^#{attr} = #{info[attr]}$/)
end
end
@ -459,12 +460,12 @@ describe 'openstack-network' do
it 'sets the log_config attribute if using syslog' do
node.set['openstack']['network']['syslog']['use'] = true
expect(chef_run).to render_file(file.name).with_content(%r(^log_config = /etc/openstack/logging.conf$))
expect(chef_run).to render_file(file.name).with_content(%r{^log_config = /etc/openstack/logging.conf$})
end
it 'does not set the log config attribute if not using syslog' do
node.set['openstack']['network']['syslog']['use'] = false
expect(chef_run).not_to render_file(file.name).with_content(%r(^log_config = /etc/openstack/logging.conf$))
expect(chef_run).not_to render_file(file.name).with_content(%r{^log_config = /etc/openstack/logging.conf$})
end
it 'set the router_distributed attribute for network node' do
@ -699,7 +700,7 @@ describe 'openstack-network' do
end
it 'sets the nova auth_url attribute' do
expect(chef_run).to render_config_file(file.name).with_section_content('nova', %r(^auth_url = http://127.0.0.1:35357/v2.0$))
expect(chef_run).to render_config_file(file.name).with_section_content('nova', %r{^auth_url = http://127.0.0.1:35357/v2.0$})
end
it 'has default nova api insecure' do
@ -742,12 +743,12 @@ describe 'openstack-network' do
it 'sets the root_helper attribute if enabled' do
node.set['openstack']['network']['use_rootwrap'] = true
expect(chef_run).to render_file(file.name).with_content(%r(^root_helper = "sudo neutron-rootwrap /etc/neutron/rootwrap.conf"$))
expect(chef_run).to render_file(file.name).with_content(%r{^root_helper = "sudo neutron-rootwrap /etc/neutron/rootwrap.conf"$})
end
it 'does not set the root_helper attribute if disabled' do
node.set['openstack']['network']['use_rootwrap'] = false
expect(chef_run).not_to render_file(file.name).with_content(%r(^root_helper = "sudo neutron-rootwrap /etc/neutron/rootwrap.conf"$))
expect(chef_run).not_to render_file(file.name).with_content(%r{^root_helper = "sudo neutron-rootwrap /etc/neutron/rootwrap.conf"$})
end
it 'sets the report_interval attribute' do
@ -756,11 +757,11 @@ describe 'openstack-network' do
end
it 'sets the auth_uri attribute' do
expect(chef_run).to render_file(file.name).with_content(%r(^auth_uri = http://127.0.0.1:5000/v2.0$))
expect(chef_run).to render_file(file.name).with_content(%r{^auth_uri = http://127.0.0.1:5000/v2.0$})
end
it 'sets the identity_uri attribute' do
expect(chef_run).to render_file(file.name).with_content(%r(^identity_uri = http://127.0.0.1:35357/$))
expect(chef_run).to render_file(file.name).with_content(%r{^identity_uri = http://127.0.0.1:35357/$})
end
it 'sets the auth_version attribute if not equal to v2.0' do
@ -895,7 +896,7 @@ describe 'openstack-network' do
it "sets the path to the #{plugin_name} plugin config" do
node.set['openstack']['network']['core_plugin'] = plugin_name
node.set['openstack']['network']['core_plugin_map'][plugin_name] = plugin_name
expect(chef_run).to render_file(file.name).with_content(%r(^NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/#{plugin_name}/#{plugin_cfg}$))
expect(chef_run).to render_file(file.name).with_content(%r{^NEUTRON_PLUGIN_CONFIG=/etc/neutron/plugins/#{plugin_name}/#{plugin_cfg}$})
end
end
end

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
describe 'centos' do
let(:runner) { ChefSpec::SoloRunner.new(CENTOS_OPTS) }
let(:node) { runner.node }

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
describe 'suse' do
let(:runner) { ChefSpec::SoloRunner.new(SUSE_OPTS) }
let(:node) { runner.node }

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::l3_agent' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::l3_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
@ -73,8 +72,8 @@ describe 'openstack-network::l3_agent' do
let(:file_name) { file.name }
end
%w[handle_internal_only_routers external_network_bridge metadata_port send_arp_for_ha
periodic_interval periodic_fuzzy_delay router_delete_namespaces].each do |attr|
%w(handle_internal_only_routers external_network_bridge metadata_port send_arp_for_ha
periodic_interval periodic_fuzzy_delay router_delete_namespaces).each do |attr|
it "displays the #{attr} l3 attribute" do
node.set['openstack']['network']['l3'][attr] = "network_l3_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{attr} = network_l3_#{attr}_value$/)
@ -99,7 +98,7 @@ describe 'openstack-network::l3_agent' do
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^ha_vrrp_advert_int = ha_vrrp_advert_int_value$/)
end
%w[router_id gateway_external_network_id].each do |conditional_attr|
%w(router_id gateway_external_network_id).each do |conditional_attr|
it "displays the #{conditional_attr} attribute when present" do
node.set['openstack']['network']['l3'][conditional_attr] = "network_l3_#{conditional_attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{conditional_attr} = network_l3_#{conditional_attr}_value$/)

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::linuxbridge' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }
@ -51,10 +50,10 @@ describe 'openstack-network::linuxbridge' do
it 'create plugin.ini symlink' do
expect(chef_run).to create_link('/etc/neutron/plugin.ini').with(
to: file.name,
owner: 'neutron',
group: 'neutron'
)
to: file.name,
owner: 'neutron',
group: 'neutron'
)
end
end
end

View File

@ -49,7 +49,7 @@ describe 'openstack-network::metadata_agent' do
context 'endpoint related attributes' do
it 'sets the auth_url attribute' do
expect(chef_run).to render_file(file.name).with_content(%r(^auth_url = http://127.0.0.1:5000/v2.0$))
expect(chef_run).to render_file(file.name).with_content(%r{^auth_url = http://127.0.0.1:5000/v2.0$})
end
end

View File

@ -27,10 +27,10 @@ describe 'openstack-network::openvswitch' do
it 'create plugin.ini symlink' do
expect(chef_run).to create_link('/etc/neutron/plugin.ini').with(
to: file.name,
owner: 'neutron',
group: 'neutron'
)
to: file.name,
owner: 'neutron',
group: 'neutron'
)
end
end
end

View File

@ -72,7 +72,7 @@ describe 'openstack-network::openvswitch' do
node.set['openstack']['network']['platform']['neutron_openvswitch_service'] = 'my-ovs-server'
node.set['openstack']['network']['platform']['neutron_openvswitch_agent_service'] = 'my-ovs-agent'
%w{my-ovs-server my-ovs-agent}.each do |service|
%w(my-ovs-server my-ovs-agent).each do |service|
expect(chef_run).to enable_service service
end
end
@ -80,7 +80,7 @@ describe 'openstack-network::openvswitch' do
it 'allows overriding package options' do
node.set['openstack']['network']['platform']['package_overrides'] = '--my-override1 --my-override2'
%w{openvswitch-switch openvswitch-datapath-dkms neutron-plugin-openvswitch neutron-plugin-openvswitch-agent}.each do |pkg|
%w(openvswitch-switch openvswitch-datapath-dkms neutron-plugin-openvswitch neutron-plugin-openvswitch-agent).each do |pkg|
expect(chef_run).to upgrade_package(pkg).with(options: '--my-override1 --my-override2')
end
end
@ -89,7 +89,7 @@ describe 'openstack-network::openvswitch' do
node.set['openstack']['network']['platform']['neutron_openvswitch_packages'] = ['my-openvswitch', 'my-other-openvswitch']
node.set['openstack']['network']['platform']['neutron_openvswitch_agent_packages'] = ['my-openvswitch-agent', 'my-other-openvswitch-agent']
%w{my-openvswitch my-other-openvswitch my-openvswitch-agent my-other-openvswitch-agent}.each do |pkg|
%w(my-openvswitch my-other-openvswitch my-openvswitch-agent my-other-openvswitch-agent).each do |pkg|
expect(chef_run).to upgrade_package(pkg)
end
end

View File

@ -46,7 +46,7 @@ describe 'openstack-network::server' do
node.set['openstack']['network']['core_plugin'] = plugin_name
node.set['openstack']['network']['plugin_conf_map'][plugin_name] = plugin_cfg
node.set['openstack']['network']['core_plugin_map'][plugin_name] = plugin_name
expect(chef_run).to render_file(file.name).with_content(%r(^NEUTRON_PLUGIN_CONF="/etc/neutron/plugins/#{plugin_cfg}"$))
expect(chef_run).to render_file(file.name).with_content(%r{^NEUTRON_PLUGIN_CONF="/etc/neutron/plugins/#{plugin_cfg}"$})
end
end
end

View File

@ -6,9 +6,7 @@ describe 'openstack-network::server' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
@ -131,8 +129,8 @@ describe 'openstack-network::server' do
it 'sets the default attributes' do
[
%r(^filters_path=/etc/neutron/rootwrap.d,/usr/share/neutron/rootwrap$),
%r(^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$),
%r{^filters_path=/etc/neutron/rootwrap.d,/usr/share/neutron/rootwrap$},
%r{^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$},
/^use_syslog=false$/,
/^syslog_log_facility=syslog$/,
/^syslog_log_level=ERROR$/

View File

@ -13,19 +13,19 @@ SUSE_OPTS = {
log_level: LOG_LEVEL
}
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
log_level: LOG_LEVEL
platform: 'redhat',
version: '7.1',
log_level: LOG_LEVEL
}
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '14.04',
log_level: LOG_LEVEL
platform: 'ubuntu',
version: '14.04',
log_level: LOG_LEVEL
}
CENTOS_OPTS = {
platform: 'centos',
version: '6.5',
log_level: LOG_LEVEL
platform: 'centos',
version: '6.5',
log_level: LOG_LEVEL
}
MOCK_NODE_NETWORK_DATA =
@ -124,7 +124,7 @@ shared_examples 'custom template banner displayer' do
end
shared_examples 'common network attributes displayer' do
%w[debug interface_driver use_namespaces].each do |attr|
%w(debug interface_driver use_namespaces).each do |attr|
it "displays the #{attr} common attribute" do
node.set['openstack']['network'][attr] = "network_#{attr}_value"
expect(chef_run).to render_file(file_name).with_content(/^#{attr} = network_#{attr}_value$/)
@ -142,8 +142,8 @@ shared_examples 'dhcp agent template configurator' do
expect(chef_run).to render_file(file_name).with_content(/^dhcp_driver = network_dhcp_driver_value$/)
end
%w[resync_interval ovs_use_veth enable_isolated_metadata
enable_metadata_network dnsmasq_lease_max dhcp_delete_namespaces].each do |attr|
%w(resync_interval ovs_use_veth enable_isolated_metadata
enable_metadata_network dnsmasq_lease_max dhcp_delete_namespaces).each do |attr|
it "displays the #{attr} dhcp attribute" do
node.set['openstack']['network']['dhcp'][attr] = "network_dhcp_#{attr}_value"
expect(chef_run).to render_file(file_name).with_content(/^#{attr} = network_dhcp_#{attr}_value$/)
@ -165,7 +165,7 @@ shared_examples 'dnsmasq template configurator' do
end
it 'displays the upstream dns servers setting' do
node.set['openstack']['network']['dhcp']['upstream_dns_servers'] = %w[server0 server1]
node.set['openstack']['network']['dhcp']['upstream_dns_servers'] = %w(server0 server1)
node['openstack']['network']['dhcp']['upstream_dns_servers'].each do |dns_server|
expect(chef_run).to render_file(file_name).with_content(/^server=#{dns_server}$/)
end

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::vpn_agent' do
describe 'redhat' do
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
let(:node) { runner.node }

View File

@ -2,7 +2,6 @@
require_relative 'spec_helper'
describe 'openstack-network::vpn_agent' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
@ -80,7 +79,7 @@ describe 'openstack-network::vpn_agent' do
end
it 'renders default_config_area for strongswan driver' do
expect(chef_run).to render_config_file(file.name).with_section_content('strongswan', %r(^default_config_area=/etc/strongswan.d$))
expect(chef_run).to render_config_file(file.name).with_section_content('strongswan', %r{^default_config_area=/etc/strongswan.d$})
end
it 'notifies the vpn agent service' do