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: I94577ea628c4f6ee81f3f9dadb24309ca7c856a3
This commit is contained in:
Mark Vanderwiel 2015-05-29 10:20:01 -05:00
parent cb833f1573
commit 133a49e150
7 changed files with 100 additions and 123 deletions

25
.rubocop_todo.yml Normal file → Executable file
View File

@ -1,5 +1,5 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-02-27 14:31:02 -0600 using RuboCop version 0.29.1.
# on 2015-05-29 10:19:10 -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
@ -9,26 +9,3 @@
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false
# Offense count: 1
# 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: 7
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Enabled: false
# Offense count: 27
# Cop supports --auto-correct.
Style/SingleSpaceBeforeFirstArg:
Enabled: false

View File

@ -19,49 +19,49 @@
#
default['openstack']['integration-test'] = {
'branch' => nil,
'disable_ssl_validation' => false,
'tenant_isolation' => true,
'tenant_reuse' => true,
'alt_ssh_user' => 'cirros',
'ssh_user' => 'cirros',
'user1' => {
'user_name' => 'tempest_user1',
'password' => 'tempest_user1_pass',
'tenant_name' => 'tempest_tenant1'
},
'user2' => {
'user_name' => 'tempest_user2',
'password' => 'tempest_user2_pass',
'tenant_name' => 'tempest_tenant2'
},
'image1' => {
'name' => 'cirros',
'id' => nil,
'flavor' => 1,
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
},
'image2' => {
'name' => 'cirros',
'id' => nil,
'flavor' => 1,
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
}
'branch' => nil,
'disable_ssl_validation' => false,
'tenant_isolation' => true,
'tenant_reuse' => true,
'alt_ssh_user' => 'cirros',
'ssh_user' => 'cirros',
'user1' => {
'user_name' => 'tempest_user1',
'password' => 'tempest_user1_pass',
'tenant_name' => 'tempest_tenant1'
},
'user2' => {
'user_name' => 'tempest_user2',
'password' => 'tempest_user2_pass',
'tenant_name' => 'tempest_tenant2'
},
'image1' => {
'name' => 'cirros',
'id' => nil,
'flavor' => 1,
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
},
'image2' => {
'name' => 'cirros',
'id' => nil,
'flavor' => 1,
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
}
}
# platform-specific settings
case platform_family
when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['integration-test']['platform'] = {
'tempest_packages' => %w{git python-virtualenv libxslt-devel
'tempest_packages' => %w(git python-virtualenv libxslt-devel
libxml2-devel python-testrepository
libffi-devel},
libffi-devel),
'package_overrides' => ''
}
when 'debian'
default['openstack']['integration-test']['platform'] = {
'tempest_packages' => %w{git libxml2-dev libxslt-dev testrepository
python-dev libffi-dev},
'tempest_packages' => %w(git libxml2-dev libxslt-dev testrepository
python-dev libffi-dev),
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
}
end

View File

@ -1,18 +1,18 @@
# encoding: UTF-8
name 'openstack-integration-test'
maintainer 'Rackspace US, Inc.'
license 'Apache 2.0'
description 'Installs and configures the Tempest Integration Test Suite'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
recipe 'openstack-integration-test::setup', 'Installs and configures Tempest'
name 'openstack-integration-test'
maintainer 'Rackspace US, Inc.'
license 'Apache 2.0'
description 'Installs and configures the Tempest Integration Test Suite'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
recipe 'openstack-integration-test::setup', 'Installs and configures Tempest'
%w{ ubuntu fedora redhat centos }.each do |os|
%w(ubuntu fedora redhat centos).each do |os|
supports os
end
depends 'openstack-common', '>= 11.0.0'
depends 'openstack-identity', '>= 11.0.0'
depends 'openstack-image', '>= 11.0.0'
depends 'openstack-compute', '>= 11.0.0'
depends 'openstack-block-storage', '>= 11.0.0'
depends 'openstack-common', '>= 11.0.0'
depends 'openstack-identity', '>= 11.0.0'
depends 'openstack-image', '>= 11.0.0'
depends 'openstack-compute', '>= 11.0.0'
depends 'openstack-block-storage', '>= 11.0.0'

View File

@ -43,45 +43,45 @@ bootstrap_token = get_secret 'openstack_identity_bootstrap_token'
auth_uri = ::URI.decode identity_admin_endpoint.to_s
admin_pass = get_password 'user', node['openstack']['identity']['admin_user']
%w{user1 user2}.each_with_index do |user, i|
%w(user1 user2).each_with_index do |user, i|
i += 1
openstack_identity_register "Register tempest tenant #{i}" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
tenant_description "Tempest tenant #{i}"
action :create_tenant
end
openstack_identity_register "Register tempest user #{i}" do
auth_uri auth_uri
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
user_name node['openstack']['integration-test'][user]['user_name']
user_pass node['openstack']['integration-test'][user]['password']
tenant_name node['openstack']['integration-test'][user]['tenant_name']
user_name node['openstack']['integration-test'][user]['user_name']
user_pass node['openstack']['integration-test'][user]['password']
action :create_user
end
openstack_identity_register "Create tempest role #{i}" do
auth_uri auth_uri
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
user_name node['openstack']['integration-test'][user]['user_name']
user_pass node['openstack']['integration-test'][user]['password']
role_name 'Member'
tenant_name node['openstack']['integration-test'][user]['tenant_name']
user_name node['openstack']['integration-test'][user]['user_name']
user_pass node['openstack']['integration-test'][user]['password']
role_name 'Member'
action :create_role
end
openstack_identity_register "Grant 'member' Role to tempest user for tempest tenant ##{i}" do
auth_uri auth_uri
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
user_name node['openstack']['integration-test'][user]['user_name']
role_name 'Member'
tenant_name node['openstack']['integration-test'][user]['tenant_name']
user_name node['openstack']['integration-test'][user]['user_name']
role_name 'Member'
action :grant_role
end
@ -89,14 +89,14 @@ end
git '/opt/tempest' do
repository 'https://github.com/openstack/tempest'
reference 'master'
reference 'master'
depth 1
action :sync
end
%w{image1 image2}.each do |img|
image_name = node['openstack']['integration-test'][img]['name']
admin_user = node['openstack']['identity']['admin_user']
%w(image1 image2).each do |img|
image_name = node['openstack']['integration-test'][img]['name']
admin_user = node['openstack']['identity']['admin_user']
admin_tenant = node['openstack']['identity']['admin_tenant_name']
openstack_image_image img do
@ -113,8 +113,8 @@ end
ruby_block "Get and set #{img}'s ID" do
block do
begin
env = openstack_command_env admin_user, admin_tenant
id = image_id image_name, env
env = openstack_command_env admin_user, admin_tenant
id = image_id image_name, env
node.set['openstack']['integration-test'][img]['id'] = id
rescue RuntimeError => e
Chef::Log.error("UUID not found for Glance image #{image_name}. Error was #{e.message}")
@ -126,31 +126,31 @@ end
template '/opt/tempest/etc/tempest.conf' do
source 'tempest.conf.erb'
owner 'root'
group 'root'
mode 00600
owner 'root'
group 'root'
mode 00600
# NOTE: We do not pass the image1/image2 node attributes above to the
# template but embed directly in the template itself instead to work
# around the variables being evaluated at compile time (prior to
# get_image_id being executed).
variables(
'tempest_disable_ssl_validation' => node['openstack']['integration-test']['disable_ssl_validation'],
'identity_endpoint_host' => identity_api_endpoint.host,
'identity_endpoint_port' => identity_api_endpoint.port,
'tempest_tenant_isolation' => node['openstack']['integration-test']['tenant_isolation'],
'tempest_tenant_reuse' => node['openstack']['integration-test']['tenant_reuse'],
'tempest_user1' => node['openstack']['integration-test']['user1']['user_name'],
'tempest_user1_pass' => node['openstack']['integration-test']['user1']['password'],
'tempest_user1_tenant' => node['openstack']['integration-test']['user1']['tenant_name'],
'tempest_img_flavor1' => node['openstack']['integration-test']['image1']['flavor'],
'tempest_img_flavor2' => node['openstack']['integration-test']['image2']['flavor'],
'tempest_admin' => node['openstack']['identity']['admin_user'],
'tempest_admin_tenant' => node['openstack']['identity']['admin_tenant_name'],
'tempest_admin_pass' => admin_pass,
'tempest_alt_ssh_user' => node['openstack']['integration-test']['alt_ssh_user'],
'tempest_ssh_user' => node['openstack']['integration-test']['ssh_user'],
'tempest_user2' => node['openstack']['integration-test']['user2']['user_name'],
'tempest_user2_pass' => node['openstack']['integration-test']['user2']['password'],
'tempest_user2_tenant' => node['openstack']['integration-test']['user2']['tenant_name']
)
'tempest_disable_ssl_validation' => node['openstack']['integration-test']['disable_ssl_validation'],
'identity_endpoint_host' => identity_api_endpoint.host,
'identity_endpoint_port' => identity_api_endpoint.port,
'tempest_tenant_isolation' => node['openstack']['integration-test']['tenant_isolation'],
'tempest_tenant_reuse' => node['openstack']['integration-test']['tenant_reuse'],
'tempest_user1' => node['openstack']['integration-test']['user1']['user_name'],
'tempest_user1_pass' => node['openstack']['integration-test']['user1']['password'],
'tempest_user1_tenant' => node['openstack']['integration-test']['user1']['tenant_name'],
'tempest_img_flavor1' => node['openstack']['integration-test']['image1']['flavor'],
'tempest_img_flavor2' => node['openstack']['integration-test']['image2']['flavor'],
'tempest_admin' => node['openstack']['identity']['admin_user'],
'tempest_admin_tenant' => node['openstack']['identity']['admin_tenant_name'],
'tempest_admin_pass' => admin_pass,
'tempest_alt_ssh_user' => node['openstack']['integration-test']['alt_ssh_user'],
'tempest_ssh_user' => node['openstack']['integration-test']['ssh_user'],
'tempest_user2' => node['openstack']['integration-test']['user2']['user_name'],
'tempest_user2_pass' => node['openstack']['integration-test']['user2']['password'],
'tempest_user2_tenant' => node['openstack']['integration-test']['user2']['tenant_name']
)
end

View File

@ -12,8 +12,8 @@ describe 'openstack-integration-test::setup' do
include_context 'tempest-stubs'
it 'installs tempest dependencies' do
packages = %w{git python-virtualenv libxslt-devel libxml2-devel
python-testrepository libffi-devel}
packages = %w(git python-virtualenv libxslt-devel libxml2-devel
python-testrepository libffi-devel)
packages.each do |pkg|
expect(chef_run).to upgrade_package(pkg)

View File

@ -12,8 +12,8 @@ describe 'openstack-integration-test::setup' do
include_context 'tempest-stubs'
it 'installs tempest dependencies' do
packages = %w{git libxml2-dev libxslt-dev testrepository python-dev
libffi-dev}
packages = %w(git libxml2-dev libxslt-dev testrepository python-dev
libffi-dev)
packages.each do |pkg|
expect(chef_run).to upgrade_package(pkg)

View File

@ -8,14 +8,14 @@ require 'chef/application'
LOG_LEVEL = :fatal
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
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
}
shared_context 'tempest-stubs' do