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: Ic874a3e0a8d005e410baa40584f0f00dfc805a56
This commit is contained in:
parent
8d1f4228d2
commit
27207cd30b
|
@ -1,84 +1,30 @@
|
||||||
# This configuration was generated by `rubocop --auto-gen-config`
|
# This configuration was generated by `rubocop --auto-gen-config`
|
||||||
# on 2015-02-27 14:34:42 -0600 using RuboCop version 0.29.1.
|
# on 2015-05-28 15:42:49 -0500 using RuboCop version 0.29.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Lint/DeprecatedClassMethods:
|
Lint/UnusedMethodArgument:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
Metrics/AbcSize:
|
||||||
Lint/StringConversionInInterpolation:
|
Max: 69
|
||||||
Enabled: false
|
|
||||||
|
# Offense count: 9
|
||||||
# Offense count: 1
|
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||||
# Cop supports --auto-correct.
|
Style/ClassAndModuleChildren:
|
||||||
Lint/UnusedMethodArgument:
|
Enabled: false
|
||||||
Enabled: false
|
|
||||||
|
# Offense count: 2
|
||||||
# Offense count: 2
|
# Configuration parameters: MinBodyLength.
|
||||||
Metrics/AbcSize:
|
Style/GuardClause:
|
||||||
Max: 69
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 1
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
||||||
Style/ClassAndModuleChildren:
|
Style/Next:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/EmptyLinesAroundBlockBody:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/FormatString:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: MinBodyLength.
|
|
||||||
Style/GuardClause:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/IndentHash:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 4
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
Style/MultilineOperationIndentation:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: EnforcedStyle, MinBodyLength, SupportedStyles.
|
|
||||||
Style/Next:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: PreferredDelimiters.
|
|
||||||
Style/PercentLiteralDelimiters:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SelfAssignment:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 30
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/SingleSpaceBeforeFirstArg:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/UnneededCapitalW:
|
|
||||||
Enabled: false
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ default['openstack']['compute']['scheduler']['scheduler_manager'] = 'nova.schedu
|
||||||
default['openstack']['compute']['scheduler']['scheduler_driver'] = 'nova.scheduler.filter_scheduler.FilterScheduler'
|
default['openstack']['compute']['scheduler']['scheduler_driver'] = 'nova.scheduler.filter_scheduler.FilterScheduler'
|
||||||
default['openstack']['compute']['scheduler']['scheduler_host_manager'] = 'nova.scheduler.host_manager.HostManager'
|
default['openstack']['compute']['scheduler']['scheduler_host_manager'] = 'nova.scheduler.host_manager.HostManager'
|
||||||
default['openstack']['compute']['scheduler']['available_filters'] = 'nova.scheduler.filters.all_filters'
|
default['openstack']['compute']['scheduler']['available_filters'] = 'nova.scheduler.filters.all_filters'
|
||||||
default['openstack']['compute']['scheduler']['default_filters'] = %W(
|
default['openstack']['compute']['scheduler']['default_filters'] = %w(
|
||||||
RetryFilter
|
RetryFilter
|
||||||
AvailabilityZoneFilter
|
AvailabilityZoneFilter
|
||||||
RamFilter
|
RamFilter
|
||||||
|
|
12
metadata.rb
12
metadata.rb
|
@ -1,10 +1,10 @@
|
||||||
name 'openstack-compute'
|
name 'openstack-compute'
|
||||||
maintainer 'openstack-chef'
|
maintainer 'openstack-chef'
|
||||||
maintainer_email 'opscode-chef-openstack@googlegroups.com'
|
maintainer_email 'opscode-chef-openstack@googlegroups.com'
|
||||||
license 'Apache 2.0'
|
license 'Apache 2.0'
|
||||||
description 'The OpenStack Compute service Nova.'
|
description 'The OpenStack Compute service Nova.'
|
||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version '11.0.0'
|
version '11.0.0'
|
||||||
|
|
||||||
recipe 'openstack-compute::api-ec2', 'Installs AWS EC2 compatible API'
|
recipe 'openstack-compute::api-ec2', 'Installs AWS EC2 compatible API'
|
||||||
recipe 'openstack-compute::api-metadata', 'Installs the nova metadata package'
|
recipe 'openstack-compute::api-metadata', 'Installs the nova metadata package'
|
||||||
|
@ -22,7 +22,7 @@ recipe 'openstack-compute::nova-setup', 'Sets up the nova database on the mysql
|
||||||
recipe 'openstack-compute::scheduler', 'Installs nova scheduler service'
|
recipe 'openstack-compute::scheduler', 'Installs nova scheduler service'
|
||||||
recipe 'openstack-compute::vncproxy', 'Installs and configures the vncproxy service for console access to VMs'
|
recipe 'openstack-compute::vncproxy', 'Installs and configures the vncproxy service for console access to VMs'
|
||||||
|
|
||||||
%w{ ubuntu fedora redhat centos suse }.each do |os|
|
%w(ubuntu fedora redhat centos suse).each do |os|
|
||||||
supports os
|
supports os
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,8 @@ end
|
||||||
|
|
||||||
template '/etc/nova/api-paste.ini' do
|
template '/etc/nova/api-paste.ini' do
|
||||||
source 'api-paste.ini.erb'
|
source 'api-paste.ini.erb'
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00644
|
mode 00644
|
||||||
notifies :restart, 'service[nova-api-ec2]'
|
notifies :restart, 'service[nova-api-ec2]'
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,8 +52,8 @@ end
|
||||||
|
|
||||||
template '/etc/nova/api-paste.ini' do
|
template '/etc/nova/api-paste.ini' do
|
||||||
source 'api-paste.ini.erb'
|
source 'api-paste.ini.erb'
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00644
|
mode 00644
|
||||||
notifies :restart, 'service[nova-api-metadata]'
|
notifies :restart, 'service[nova-api-metadata]'
|
||||||
end
|
end
|
||||||
|
|
|
@ -55,8 +55,8 @@ end
|
||||||
|
|
||||||
template '/etc/nova/api-paste.ini' do
|
template '/etc/nova/api-paste.ini' do
|
||||||
source 'api-paste.ini.erb'
|
source 'api-paste.ini.erb'
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00644
|
mode 00644
|
||||||
notifies :restart, 'service[nova-api-os-compute]'
|
notifies :restart, 'service[nova-api-os-compute]'
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,7 +75,7 @@ end
|
||||||
|
|
||||||
cookbook_file '/etc/nova/nova-compute.conf' do
|
cookbook_file '/etc/nova/nova-compute.conf' do
|
||||||
source 'nova-compute.conf'
|
source 'nova-compute.conf'
|
||||||
mode 00644
|
mode 00644
|
||||||
|
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
@ -103,10 +103,10 @@ group docker_group do
|
||||||
end
|
end
|
||||||
|
|
||||||
file 'docker.filter' do
|
file 'docker.filter' do
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 00644
|
||||||
path filter_target_path
|
path filter_target_path
|
||||||
content lazy { ::File.open(filter_source_path).read }
|
content lazy { ::File.open(filter_source_path).read }
|
||||||
action :create
|
action :create
|
||||||
only_if { node['openstack']['compute']['docker']['enable'] }
|
only_if { node['openstack']['compute']['docker']['enable'] }
|
||||||
|
|
|
@ -51,7 +51,7 @@ git_download_directory = "#{Chef::Config['file_cache_path']}/nova-docker"
|
||||||
|
|
||||||
git git_download_directory do
|
git git_download_directory do
|
||||||
repository github_repository
|
repository github_repository
|
||||||
revision github_branch
|
revision github_branch
|
||||||
action :sync
|
action :sync
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,9 @@ end
|
||||||
|
|
||||||
def update_boot_kernel_and_trigger_reboot(flavor = 'default') # rubocop:disable MethodLength
|
def update_boot_kernel_and_trigger_reboot(flavor = 'default') # rubocop:disable MethodLength
|
||||||
# only default and xen flavor is supported by this helper right now
|
# only default and xen flavor is supported by this helper right now
|
||||||
if File.exists?('/boot/grub/menu.lst')
|
if File.exist?('/boot/grub/menu.lst')
|
||||||
update_grub_default_kernel(flavor)
|
update_grub_default_kernel(flavor)
|
||||||
elsif File.exists?('/etc/default/grub')
|
elsif File.exist?('/etc/default/grub')
|
||||||
update_grub2_default_kernel(flavor)
|
update_grub2_default_kernel(flavor)
|
||||||
else
|
else
|
||||||
::Chef::Application.fatal!(
|
::Chef::Application.fatal!(
|
||||||
|
@ -141,7 +141,7 @@ group node['openstack']['compute']['libvirt']['group'] do
|
||||||
members [node['openstack']['compute']['group']]
|
members [node['openstack']['compute']['group']]
|
||||||
|
|
||||||
action :create
|
action :create
|
||||||
only_if { platform_family? %w{suse fedora rhel} }
|
only_if { platform_family? %w(suse fedora rhel) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL#Installing_within_a_VM
|
# http://fedoraproject.org/wiki/Getting_started_with_OpenStack_EPEL#Installing_within_a_VM
|
||||||
|
@ -149,7 +149,7 @@ end
|
||||||
link '/usr/bin/qemu-system-x86_64' do
|
link '/usr/bin/qemu-system-x86_64' do
|
||||||
to '/usr/libexec/qemu-kvm'
|
to '/usr/libexec/qemu-kvm'
|
||||||
|
|
||||||
only_if { platform_family? %w{fedora rhel} }
|
only_if { platform_family? %w(fedora rhel) }
|
||||||
end
|
end
|
||||||
|
|
||||||
service 'dbus' do
|
service 'dbus' do
|
||||||
|
@ -181,9 +181,9 @@ end
|
||||||
# TODO(breu): this section needs to be rewritten to support key privisioning
|
# TODO(breu): this section needs to be rewritten to support key privisioning
|
||||||
template '/etc/libvirt/libvirtd.conf' do
|
template '/etc/libvirt/libvirtd.conf' do
|
||||||
source 'libvirtd.conf.erb'
|
source 'libvirtd.conf.erb'
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 00644
|
||||||
variables(
|
variables(
|
||||||
auth_tcp: node['openstack']['compute']['libvirt']['auth_tcp'],
|
auth_tcp: node['openstack']['compute']['libvirt']['auth_tcp'],
|
||||||
libvirt_group: node['openstack']['compute']['libvirt']['group']
|
libvirt_group: node['openstack']['compute']['libvirt']['group']
|
||||||
|
@ -195,24 +195,24 @@ end
|
||||||
|
|
||||||
template '/etc/default/libvirt-bin' do
|
template '/etc/default/libvirt-bin' do
|
||||||
source 'libvirt-bin.erb'
|
source 'libvirt-bin.erb'
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 00644
|
||||||
|
|
||||||
notifies :restart, 'service[libvirt-bin]', :immediately
|
notifies :restart, 'service[libvirt-bin]', :immediately
|
||||||
|
|
||||||
only_if { platform_family? %w{debian} }
|
only_if { platform_family? 'debian' }
|
||||||
end
|
end
|
||||||
|
|
||||||
template '/etc/sysconfig/libvirtd' do
|
template '/etc/sysconfig/libvirtd' do
|
||||||
source 'libvirtd.erb'
|
source 'libvirtd.erb'
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 00644
|
||||||
|
|
||||||
notifies :restart, 'service[libvirt-bin]', :immediately
|
notifies :restart, 'service[libvirt-bin]', :immediately
|
||||||
|
|
||||||
only_if { platform_family? %w{fedora rhel} }
|
only_if { platform_family? %w(fedora rhel) }
|
||||||
end
|
end
|
||||||
|
|
||||||
volume_backend = node['openstack']['compute']['libvirt']['volume_backend']
|
volume_backend = node['openstack']['compute']['libvirt']['volume_backend']
|
||||||
|
|
|
@ -56,7 +56,7 @@ end
|
||||||
directory '/etc/nova' do
|
directory '/etc/nova' do
|
||||||
owner node['openstack']['compute']['user']
|
owner node['openstack']['compute']['user']
|
||||||
group node['openstack']['compute']['group']
|
group node['openstack']['compute']['group']
|
||||||
mode 00750
|
mode 00750
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -110,14 +110,14 @@ image_endpoint = internal_endpoint 'image-api'
|
||||||
ironic_endpoint = internal_endpoint 'bare-metal-api'
|
ironic_endpoint = internal_endpoint 'bare-metal-api'
|
||||||
ironic_admin_password = get_password 'service', 'openstack-bare-metal'
|
ironic_admin_password = get_password 'service', 'openstack-bare-metal'
|
||||||
|
|
||||||
Chef::Log.debug("openstack-compute::nova-common:identity_endpoint|#{identity_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:identity_endpoint|#{identity_endpoint}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:xvpvnc_endpoint|#{xvpvnc_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:xvpvnc_endpoint|#{xvpvnc_endpoint}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:novnc_endpoint|#{novnc_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:novnc_endpoint|#{novnc_endpoint}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:compute_api_endpoint|#{::URI.decode compute_api_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:compute_api_endpoint|#{::URI.decode compute_api_endpoint.to_s}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:ec2_public_endpoint|#{ec2_public_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:ec2_public_endpoint|#{ec2_public_endpoint}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:network_endpoint|#{network_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:network_endpoint|#{network_endpoint}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:image_endpoint|#{image_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:image_endpoint|#{image_endpoint}")
|
||||||
Chef::Log.debug("openstack-compute::nova-common:ironic_endpoint|#{ironic_endpoint.to_s}")
|
Chef::Log.debug("openstack-compute::nova-common:ironic_endpoint|#{ironic_endpoint}")
|
||||||
|
|
||||||
if node['openstack']['compute']['network']['service_type'] == 'neutron'
|
if node['openstack']['compute']['network']['service_type'] == 'neutron'
|
||||||
neutron_admin_password = get_password 'service', 'openstack-network'
|
neutron_admin_password = get_password 'service', 'openstack-network'
|
||||||
|
@ -182,9 +182,9 @@ end
|
||||||
template '/etc/nova/rootwrap.conf' do
|
template '/etc/nova/rootwrap.conf' do
|
||||||
source 'rootwrap.conf.erb'
|
source 'rootwrap.conf.erb'
|
||||||
# Must be root!
|
# Must be root!
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode 00644
|
mode 00644
|
||||||
end
|
end
|
||||||
|
|
||||||
execute 'enable nova login' do
|
execute 'enable nova login' do
|
||||||
|
|
|
@ -48,7 +48,7 @@ when 'nova'
|
||||||
# are 'label' and 'ipv4_cidr'.
|
# are 'label' and 'ipv4_cidr'.
|
||||||
cmd = "nova-manage network create --label=#{net['label']} --fixed_range_v4=#{net['ipv4_cidr']}"
|
cmd = "nova-manage network create --label=#{net['label']} --fixed_range_v4=#{net['ipv4_cidr']}"
|
||||||
cmd += " --multi_host='#{net['multi_host']}'" if net.key?('multi_host')
|
cmd += " --multi_host='#{net['multi_host']}'" if net.key?('multi_host')
|
||||||
%w{num_networks network_size bridge dns1 dns2}.each do |v|
|
%w(num_networks network_size bridge dns1 dns2).each do |v|
|
||||||
cmd += " --#{v}=#{net[v]}" if net.key?(v)
|
cmd += " --#{v}=#{net[v]}" if net.key?(v)
|
||||||
end
|
end
|
||||||
# Older attributes have the key as 'bridge_dev' instead
|
# Older attributes have the key as 'bridge_dev' instead
|
||||||
|
@ -61,7 +61,7 @@ when 'nova'
|
||||||
cmd += " --vlan=#{net['vlan']}"
|
cmd += " --vlan=#{net['vlan']}"
|
||||||
elsif node['openstack']['compute']['network']['network_manager'] == 'nova.network.manager.VlanManager'
|
elsif node['openstack']['compute']['network']['network_manager'] == 'nova.network.manager.VlanManager'
|
||||||
cmd += " --vlan=#{next_vlan}"
|
cmd += " --vlan=#{next_vlan}"
|
||||||
next_vlan = next_vlan + 1
|
next_vlan += 1
|
||||||
end
|
end
|
||||||
command cmd
|
command cmd
|
||||||
not_if "nova-manage network list | grep #{net['ipv4_cidr']}", user: nova_user, group: nova_group
|
not_if "nova-manage network list | grep #{net['ipv4_cidr']}", user: nova_user, group: nova_group
|
||||||
|
@ -74,7 +74,7 @@ when 'nova'
|
||||||
user 'root'
|
user 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
source 'add_floaters.py'
|
source 'add_floaters.py'
|
||||||
mode 00755
|
mode 00755
|
||||||
|
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
@ -116,7 +116,7 @@ when 'neutron'
|
||||||
user 'root'
|
user 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
source 'add_floaters.py'
|
source 'add_floaters.py'
|
||||||
mode 00755
|
mode 00755
|
||||||
|
|
||||||
action :create
|
action :create
|
||||||
end
|
end
|
||||||
|
@ -128,7 +128,7 @@ when 'neutron'
|
||||||
execute 'neutron floating create' do
|
execute 'neutron floating create' do
|
||||||
command cmd
|
command cmd
|
||||||
not_if ". /root/openrc && neutron floatingip-list |grep -E '.*([0-9]{1,3}[\.]){3}[0-9]{1,3}*'"
|
not_if ". /root/openrc && neutron floatingip-list |grep -E '.*([0-9]{1,3}[\.]){3}[0-9]{1,3}*'"
|
||||||
only_if { File.exists?('/root/openrc') }
|
only_if { File.exist?('/root/openrc') }
|
||||||
|
|
||||||
action :run
|
action :run
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-compute::client' do
|
describe 'openstack-compute::client' do
|
||||||
|
|
||||||
describe 'redhat' do
|
describe 'redhat' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
require_relative 'spec_helper'
|
require_relative 'spec_helper'
|
||||||
|
|
||||||
describe 'openstack-compute::client' do
|
describe 'openstack-compute::client' do
|
||||||
|
|
||||||
describe 'ubuntu' do
|
describe 'ubuntu' do
|
||||||
|
|
||||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||||
let(:node) { runner.node }
|
let(:node) { runner.node }
|
||||||
let(:chef_run) do
|
let(:chef_run) do
|
||||||
|
|
|
@ -73,7 +73,7 @@ describe 'openstack-compute::compute' do
|
||||||
expect(chef_run).to upgrade_package('nova-compute-qemu').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
|
expect(chef_run).to upgrade_package('nova-compute-qemu').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
|
||||||
end
|
end
|
||||||
|
|
||||||
%w{qemu kvm}.each do |virt_type|
|
%w(qemu kvm).each do |virt_type|
|
||||||
it "honors the package name platform overrides for #{virt_type}" do
|
it "honors the package name platform overrides for #{virt_type}" do
|
||||||
node.set['openstack']['compute']['libvirt']['virt_type'] = virt_type
|
node.set['openstack']['compute']['libvirt']['virt_type'] = virt_type
|
||||||
node.set['openstack']['compute']['platform']["#{virt_type}_compute_packages"] = ["my-nova-#{virt_type}"]
|
node.set['openstack']['compute']['platform']["#{virt_type}_compute_packages"] = ["my-nova-#{virt_type}"]
|
||||||
|
@ -87,13 +87,10 @@ describe 'openstack-compute::compute' do
|
||||||
|
|
||||||
it 'creates the file' do
|
it 'creates the file' do
|
||||||
expect(chef_run).to create_cookbook_file(file.name).with(
|
expect(chef_run).to create_cookbook_file(file.name).with(
|
||||||
source: 'nova-compute.conf'
|
source: 'nova-compute.conf',
|
||||||
|
mode: 00644
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has proper modes' do
|
|
||||||
expect(sprintf('%o', file.mode)).to eq '644'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'runs libvirt recipe' do
|
it 'runs libvirt recipe' do
|
||||||
|
|
|
@ -98,7 +98,7 @@ describe 'openstack-compute::nova-common' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'has default ssl options set' do
|
it 'has default ssl options set' do
|
||||||
%W(ssl_only=false
|
%w(ssl_only=false
|
||||||
cert=self.pem
|
cert=self.pem
|
||||||
key=).each do |line|
|
key=).each do |line|
|
||||||
expect(chef_run).to render_file(file.name).with_content(/^#{line}$/)
|
expect(chef_run).to render_file(file.name).with_content(/^#{line}$/)
|
||||||
|
@ -843,11 +843,10 @@ describe 'openstack-compute::nova-common' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets the upgrade levels' do
|
it 'sets the upgrade levels' do
|
||||||
node.set['openstack']['compute']['upgrade_levels'] = {
|
node.set['openstack']['compute']['upgrade_levels'] = { 'compute' => 'juno',
|
||||||
'compute' => 'juno',
|
'cert' => '3.0',
|
||||||
'cert' => '3.0',
|
'network' => 'havana'
|
||||||
'network' => 'havana'
|
}
|
||||||
}
|
|
||||||
node['openstack']['compute']['upgrade_levels'].each do |key, val|
|
node['openstack']['compute']['upgrade_levels'].each do |key, val|
|
||||||
expect(chef_run).to render_config_file(file.name).with_section_content('upgrade_levels', /^#{key} = #{val}$/)
|
expect(chef_run).to render_config_file(file.name).with_section_content('upgrade_levels', /^#{key} = #{val}$/)
|
||||||
end
|
end
|
||||||
|
@ -874,8 +873,8 @@ describe 'openstack-compute::nova-common' do
|
||||||
|
|
||||||
it 'sets the default attributes' do
|
it 'sets the default attributes' do
|
||||||
[
|
[
|
||||||
%r(^filters_path=/etc/nova/rootwrap.d,/usr/share/nova/rootwrap$),
|
%r{^filters_path=/etc/nova/rootwrap.d,/usr/share/nova/rootwrap$},
|
||||||
%r(^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$),
|
%r{^exec_dirs=/sbin,/usr/sbin,/bin,/usr/bin$},
|
||||||
/^use_syslog=False$/,
|
/^use_syslog=False$/,
|
||||||
/^syslog_log_facility=syslog$/,
|
/^syslog_log_facility=syslog$/,
|
||||||
/^syslog_log_level=ERROR$/
|
/^syslog_log_level=ERROR$/
|
||||||
|
|
|
@ -164,25 +164,25 @@ def expect_creates_api_paste(service, action = :restart) # rubocop:disable Metho
|
||||||
|
|
||||||
it 'sets the pipeline attribute' do
|
it 'sets the pipeline attribute' do
|
||||||
expect(chef_run).to render_file(file.name)
|
expect(chef_run).to render_file(file.name)
|
||||||
.with_content(/^pipeline = ec2faultwrap logrequest metaapp$/)
|
.with_content(/^pipeline = ec2faultwrap logrequest metaapp$/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets ec2 attributes' do
|
it 'sets ec2 attributes' do
|
||||||
expect(chef_run).to render_file(file.name)
|
expect(chef_run).to render_file(file.name)
|
||||||
.with_content(/^\[composite:ec2\]$/)
|
.with_content(/^\[composite:ec2\]$/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sets the pipeline attribute when ec2 api is disabled' do
|
it 'sets the pipeline attribute when ec2 api is disabled' do
|
||||||
node.set['openstack']['compute']['enabled_apis'] = []
|
node.set['openstack']['compute']['enabled_apis'] = []
|
||||||
expect(chef_run).to render_file(file.name)
|
expect(chef_run).to render_file(file.name)
|
||||||
.with_content(/^pipeline = faultwrap metaapp$/)
|
.with_content(/^pipeline = faultwrap metaapp$/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'pastes the misc attributes' do
|
it 'pastes the misc attributes' do
|
||||||
node.set['openstack']['compute']['misc_paste'] = %w(paste1 paste2)
|
node.set['openstack']['compute']['misc_paste'] = %w(paste1 paste2)
|
||||||
expect(chef_run).to render_file(file.name)
|
expect(chef_run).to render_file(file.name)
|
||||||
.with_content(/^paste1$/).with_content(/^paste2$/)
|
.with_content(/^paste1$/).with_content(/^paste2$/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue