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: I6097cd1032a5b2305d9a6ca8cb2e2b19f6a57a1e
This commit is contained in:
parent
103b626560
commit
e53ae638f1
|
@ -1,44 +1,11 @@
|
|||
# This configuration was generated by `rubocop --auto-gen-config`
|
||||
# on 2015-02-27 13:36:11 -0600 using RuboCop version 0.29.1.
|
||||
# on 2015-05-29 10:08:48 -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: 3
|
||||
# Cop supports --auto-correct.
|
||||
Lint/StringConversionInInterpolation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/ClassAndModuleChildren:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 5
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/EmptyLinesAroundBlockBody:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 3
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/FormatString:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 2
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
||||
Style/MultilineOperationIndentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 10
|
||||
# Cop supports --auto-correct.
|
||||
# Configuration parameters: PreferredDelimiters.
|
||||
Style/PercentLiteralDelimiters:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 26
|
||||
# Cop supports --auto-correct.
|
||||
Style/SingleSpaceBeforeFirstArg:
|
||||
Enabled: false
|
||||
|
|
|
@ -203,7 +203,7 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
|
|||
default['openstack']['image']['user'] = 'glance'
|
||||
default['openstack']['image']['group'] = 'glance'
|
||||
default['openstack']['image']['platform'] = {
|
||||
'image_packages' => %w{openstack-glance cronie python-glanceclient},
|
||||
'image_packages' => %w(openstack-glance cronie python-glanceclient),
|
||||
'image_client_packages' => ['python-glanceclient'],
|
||||
'ceph_packages' => ['python-ceph'],
|
||||
'swift_packages' => ['openstack-swift'],
|
||||
|
|
30
metadata.rb
30
metadata.rb
|
@ -1,20 +1,20 @@
|
|||
name 'openstack-image'
|
||||
maintainer 'openstack-chef'
|
||||
name 'openstack-image'
|
||||
maintainer 'openstack-chef'
|
||||
maintainer_email 'opscode-chef-openstack@googlegroups.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs and configures the Glance Image Registry and Delivery Service'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '11.0.0'
|
||||
recipe 'openstack-image::api', 'Installs packages required for a glance api server'
|
||||
recipe 'openstack-image::client', 'Install packages required for glance client'
|
||||
recipe 'openstack-image::registry', 'Installs packages required for a glance registry server'
|
||||
recipe 'openstack-image::identity_registration', 'Registers Glance endpoints and service with Keystone'
|
||||
recipe 'openstack-image::image_upload', 'Upload image using glance image-create command'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs and configures the Glance Image Registry and Delivery Service'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '11.0.0'
|
||||
recipe 'openstack-image::api', 'Installs packages required for a glance api server'
|
||||
recipe 'openstack-image::client', 'Install packages required for glance client'
|
||||
recipe 'openstack-image::registry', 'Installs packages required for a glance registry server'
|
||||
recipe 'openstack-image::identity_registration', 'Registers Glance endpoints and service with Keystone'
|
||||
recipe 'openstack-image::image_upload', 'Upload image using glance image-create command'
|
||||
|
||||
%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.0.0'
|
||||
depends 'openstack-identity', '>= 11.0.0'
|
||||
depends 'ceph', '~> 0.8.0'
|
||||
depends 'openstack-common', '>= 11.0.0'
|
||||
depends 'openstack-identity', '>= 11.0.0'
|
||||
depends 'ceph', '~> 0.8.0'
|
||||
|
|
|
@ -73,7 +73,7 @@ def _upload_image_bare(name, api, url, public, type)
|
|||
execute "Uploading #{type} image #{name}" do
|
||||
cwd '/tmp'
|
||||
command "#{glance_cmd} image-create --name #{name} --is-public #{public} #{c_fmt} #{d_fmt} --location #{url}"
|
||||
not_if "#{glance_cmd} image-list | grep #{name.to_s}"
|
||||
not_if "#{glance_cmd} image-list | grep #{name}"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -113,6 +113,6 @@ def _upload_ami(name, api, url, public) # rubocop:disable MethodLength
|
|||
rid=$(#{glance_cmd} image-create --name "${image_name}-initrd" --is-public #{public} #{ari_fmt} < ${ramdisk} | grep -m 1 '^|[ ]*id[ ]*|' | cut -d'|' -f3 | sed 's/ //')
|
||||
#{glance_cmd} image-create --name "#{name}" --is-public #{public} #{ami_fmt} --property "kernel_id=$kid" --property "ramdisk_id=$rid" < ${kernel}
|
||||
EOH
|
||||
not_if "#{glance_cmd} image-list | grep #{name.to_s}"
|
||||
not_if "#{glance_cmd} image-list | grep #{name}"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -88,7 +88,7 @@ end
|
|||
directory '/etc/glance' do
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode 00700
|
||||
mode 00700
|
||||
end
|
||||
|
||||
directory ::File.dirname node['openstack']['image']['api']['auth']['cache_dir'] do
|
||||
|
@ -163,7 +163,7 @@ template '/etc/glance/glance-api.conf' do
|
|||
source 'glance-api.conf.erb'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode 00640
|
||||
mode 00640
|
||||
variables(
|
||||
api_bind_address: api_bind.host,
|
||||
api_bind_port: api_bind.port,
|
||||
|
@ -194,7 +194,7 @@ template '/etc/glance/glance-cache.conf' do
|
|||
source 'glance-cache.conf.erb'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode 00640
|
||||
mode 00640
|
||||
variables(
|
||||
registry_ip_address: registry_endpoint.host,
|
||||
registry_port: registry_endpoint.port,
|
||||
|
@ -208,7 +208,7 @@ template '/etc/glance/glance-scrubber.conf' do
|
|||
source 'glance-scrubber.conf.erb'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode 00640
|
||||
mode 00640
|
||||
variables(
|
||||
registry_ip_address: registry_endpoint.host,
|
||||
registry_port: registry_endpoint.port
|
||||
|
@ -223,8 +223,8 @@ end
|
|||
|
||||
# Configure glance-cache-cleaner to run at 00:01 everyday
|
||||
cron 'glance-cache-cleaner' do
|
||||
minute '01'
|
||||
hour '00'
|
||||
minute '01'
|
||||
hour '00'
|
||||
command "/usr/bin/glance-cache-cleaner #{node['openstack']['image']['cron']['redirection']}"
|
||||
end
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ node['openstack']['image']['upload_images'].each do |img|
|
|||
type = 'unknown'
|
||||
type = node['openstack']['image']['upload_image_type'][img.to_sym] if node['openstack']['image']['upload_image_type'][img.to_sym]
|
||||
|
||||
openstack_image_image "Image setup for #{img.to_s}" do
|
||||
openstack_image_image "Image setup for #{img}" do
|
||||
image_url node['openstack']['image']['upload_image'][img.to_sym]
|
||||
image_name img
|
||||
image_type type
|
||||
|
|
|
@ -100,14 +100,14 @@ end
|
|||
directory '/etc/glance' do
|
||||
owner glance_user
|
||||
group glance_group
|
||||
mode 00700
|
||||
mode 00700
|
||||
end
|
||||
|
||||
template '/etc/glance/glance-registry.conf' do
|
||||
source 'glance-registry.conf.erb'
|
||||
owner node['openstack']['image']['user']
|
||||
group node['openstack']['image']['group']
|
||||
mode 00640
|
||||
mode 00640
|
||||
variables(
|
||||
:registry_bind_address => registry_bind.host,
|
||||
:registry_bind_port => registry_bind.port,
|
||||
|
|
|
@ -199,7 +199,7 @@ describe 'openstack-image::api' do
|
|||
|
||||
it 'sets the filesystem_store_metadata_file attribute' do
|
||||
node.set['openstack']['image']['filesystem_store_metadata_file'] = '/etc/glance/images.json'
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^filesystem_store_metadata_file = /etc/glance/images.json$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^filesystem_store_metadata_file = /etc/glance/images.json$})
|
||||
end
|
||||
|
||||
context 'api related attributes' do
|
||||
|
@ -241,12 +241,12 @@ describe 'openstack-image::api' do
|
|||
context 'syslog use' do
|
||||
it 'shows log_config if syslog use is enabled' do
|
||||
node.set['openstack']['image']['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 'shows log_file if syslog use is disabled' do
|
||||
node.set['openstack']['image']['syslog']['use'] = false
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^log_file = /var/log/glance/api.log$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^log_file = /var/log/glance/api.log$})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -307,7 +307,6 @@ describe 'openstack-image::api' do
|
|||
node.set['openstack']['image']['api']['swift_store_user'] = 'swift_store_user_value'
|
||||
expect(chef_run).to render_file(file.name).with_content(/^swift_store_user = swift_user_tenant_value:swift_store_user_value$/)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context 'store auth disabled' do
|
||||
|
@ -316,7 +315,7 @@ describe 'openstack-image::api' do
|
|||
end
|
||||
|
||||
it 'sets the auth address' do
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^swift_store_auth_address = http://127.0.0.1:5000/v2.0$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^swift_store_auth_address = http://127.0.0.1:5000/v2.0$})
|
||||
end
|
||||
|
||||
it 'sets the auth version' do
|
||||
|
@ -509,12 +508,12 @@ describe 'openstack-image::api' do
|
|||
context 'syslog options' do
|
||||
it 'sets the log_config attribute if syslog use is enabled' do
|
||||
node.set['openstack']['image']['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 'sets the log_file attribute if syslog use is disabled' do
|
||||
node.set['openstack']['image']['syslog']['use'] = false
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^log_file = /var/log/glance/image-cache.log$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^log_file = /var/log/glance/image-cache.log$})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::client' do
|
||||
|
||||
describe 'redhat' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-image::client' do
|
||||
|
||||
describe 'ubuntu' do
|
||||
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
let(:chef_run) do
|
||||
|
|
|
@ -39,7 +39,7 @@ describe 'openstack-image::registry' do
|
|||
expect(chef_run).to upgrade_package('my-mysql-py').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
|
||||
end
|
||||
|
||||
%w{db2 postgresql}.each do |service_type|
|
||||
%w(db2 postgresql).each do |service_type|
|
||||
it "upgrades #{service_type} python packages if chosen" do
|
||||
node.set['openstack']['db']['image']['service_type'] = service_type
|
||||
node.set['openstack']['db']['python_packages'][service_type] = ["my-#{service_type}-py"]
|
||||
|
@ -243,7 +243,6 @@ describe 'openstack-image::registry' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
it 'notifies glance-registry restart' do
|
||||
|
|
|
@ -58,8 +58,8 @@ shared_context 'image-stubs' do
|
|||
.and_return 'vmware_secret_name'
|
||||
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('db', anything)
|
||||
.and_return('')
|
||||
.with('db', anything)
|
||||
.and_return('')
|
||||
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||
.with('service', 'openstack-image')
|
||||
.and_return('glance-pass')
|
||||
|
@ -115,13 +115,12 @@ shared_examples 'cache-directory' do
|
|||
describe '/var/cache/glance' do
|
||||
let(:dir) { chef_run.directory('/var/cache/glance') }
|
||||
|
||||
it 'has proper owner' do
|
||||
expect(dir.owner).to eq('glance')
|
||||
expect(dir.group).to eq('glance')
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', dir.mode)).to eq '700'
|
||||
it 'creates directory /var/cache/glance' do
|
||||
expect(chef_run).to create_directory(dir.name).with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: 00700
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -130,17 +129,13 @@ shared_examples 'image-lib-cache-directory' do
|
|||
describe '/var/lib/glance/image-cache/' do
|
||||
let(:dir) { chef_run.directory('/var/lib/glance/image-cache/') }
|
||||
|
||||
it 'has proper owner' do
|
||||
expect(dir.owner).to eq('glance')
|
||||
expect(dir.group).to eq('glance')
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', dir.mode)).to eq '755'
|
||||
end
|
||||
|
||||
it 'creates directory recursively' do
|
||||
expect(dir.recursive).to eq(true)
|
||||
it 'creates directory /var/lib/glance/image-cache' do
|
||||
expect(chef_run).to create_directory(dir.name).with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: 00755,
|
||||
recursive: true
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -149,13 +144,12 @@ shared_examples 'glance-directory' do
|
|||
describe '/etc/glance' do
|
||||
let(:dir) { chef_run.directory('/etc/glance') }
|
||||
|
||||
it 'has proper owner' do
|
||||
expect(dir.owner).to eq('glance')
|
||||
expect(dir.group).to eq('glance')
|
||||
end
|
||||
|
||||
it 'has proper modes' do
|
||||
expect(sprintf('%o', dir.mode)).to eq '700'
|
||||
it 'creates directory /etc/glance' do
|
||||
expect(chef_run).to create_directory(dir.name).with(
|
||||
user: 'glance',
|
||||
group: 'glance',
|
||||
mode: 00700
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -190,22 +184,22 @@ end
|
|||
shared_examples 'syslog use' do
|
||||
it 'shows log_config if syslog use is enabled' do
|
||||
node.set['openstack']['image']['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 'shows log_file if syslog use is disabled' do
|
||||
node.set['openstack']['image']['syslog']['use'] = false
|
||||
expect(chef_run).to render_file(file.name).with_content(%r(^log_file = /var/log/glance/#{log_file_name}$))
|
||||
expect(chef_run).to render_file(file.name).with_content(%r{^log_file = /var/log/glance/#{log_file_name}$})
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'keystone attribute setter' do |version|
|
||||
it 'sets the auth_uri value' 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 value' 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
|
||||
|
||||
context 'auth version' do
|
||||
|
|
Loading…
Reference in New Issue