Initial image Pike updates

- Switched default linter to cookstyle
- Freshened image locations
- Renamed rake tasks to align with Chef conventions
- Normalized template comment

Change-Id: Ib99d9b12f036ff52e44a270455f0d2e16561f98a
This commit is contained in:
Samuel Cassiba 2017-08-20 12:17:14 -04:00
parent 8194db94e4
commit 7eb5fd6113
10 changed files with 36 additions and 69 deletions

View File

@ -1,44 +1,12 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2017-08-17 14:16:11 +0200 using RuboCop version 0.47.1.
# on 2017-08-25 09:41:52 -0400 using RuboCop version 0.47.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: 16
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 198
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 28
# Offense count: 2
# Configuration parameters: CountKeywordArgs.
Metrics/ParameterLists:
Max: 6
# Offense count: 5
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: nested, compact
Style/ClassAndModuleChildren:
Exclude:
- 'recipes/api.rb'
- 'recipes/identity_registration.rb'
- 'recipes/image_upload.rb'
- 'recipes/registry.rb'
- 'recipes/swift_store.rb'
# Offense count: 5
Style/Documentation:
Exclude:
- 'spec/**/*'
- 'test/**/*'
- 'recipes/api.rb'
- 'recipes/identity_registration.rb'
- 'recipes/image_upload.rb'
- 'recipes/registry.rb'
- 'recipes/swift_store.rb'

View File

@ -1,20 +1,20 @@
task default: ["test"]
task :test => [:lint, :style, :unit]
task :test => [:syntax, :lint, :unit]
desc "Vendor the cookbooks in the Berksfile"
task :berks_prep do
sh %{chef exec berks vendor}
end
desc "Run FoodCritic (lint) tests"
task :lint do
sh %{chef exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
desc "Run FoodCritic (syntax) tests"
task :syntax do
sh %{chef exec foodcritic --exclude spec -f any .}
end
desc "Run RuboCop (style) tests"
task :style do
sh %{chef exec rubocop}
desc "Run RuboCop (lint) tests"
task :lint do
sh %{chef exec cookstyle}
end
desc "Run RSpec (unit) tests"

View File

@ -23,8 +23,8 @@
# Set to some text value if you want templated config files
# to contain a custom banner at the top of the written file
default['openstack']['image']['custom_template_banner'] = '
# This file autogenerated by Chef
# Do not edit, changes will be overwritten
# This file is automatically generated by Chef
# Any changes will be overwritten
'
# SSL Options
@ -70,10 +70,9 @@ default['openstack']['image']['cache']['grace_period'] = 3600
# Default Image Locations
default['openstack']['image']['upload_images'] = ['cirros']
default['openstack']['image']['upload_image']['precise'] = 'http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img'
default['openstack']['image']['upload_image']['oneiric'] = 'http://cloud-images.ubuntu.com/oneiric/current/oneiric-server-cloudimg-amd64-disk1.img'
default['openstack']['image']['upload_image']['natty'] = 'http://cloud-images.ubuntu.com/natty/current/natty-server-cloudimg-amd64-disk1.img'
default['openstack']['image']['upload_image']['cirros'] = 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img'
default['openstack']['image']['upload_image']['xenial'] = 'http://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img'
default['openstack']['image']['upload_image']['zesty'] = 'http://cloud-images.ubuntu.com/zesty/current/zesty-server-cloudimg-amd64-disk1.img'
default['openstack']['image']['upload_image']['cirros'] = 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img'
# more images available at https://github.com/rackerjoe/oz-image-build
default['openstack']['image']['upload_image']['centos'] = 'http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2'
# To override image type
@ -104,7 +103,7 @@ when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'image_api_service' => 'openstack-glance-api',
'image_registry_service' => 'openstack-glance-registry',
'image_api_process_name' => 'glance-api',
'package_overrides' => ''
'package_overrides' => '',
}
when 'suse'
default['openstack']['image']['user'] = 'openstack-glance'
@ -116,7 +115,7 @@ when 'suse'
'image_api_service' => 'openstack-glance-api',
'image_registry_service' => 'openstack-glance-registry',
'image_api_process_name' => 'glance-api',
'package_overrides' => ''
'package_overrides' => '',
}
when 'debian'
default['openstack']['image']['user'] = 'glance'
@ -128,7 +127,7 @@ when 'debian'
'image_api_service' => 'glance-api',
'image_registry_service' => 'glance-registry',
'image_registry_process_name' => 'glance-registry',
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'",
}
end

View File

@ -184,6 +184,6 @@ service 'glance-api' do
subscribes :restart, [
'template[/etc/glance/glance-scrubber.conf]',
'template[/etc/glance/glance-cache.conf]',
'template[/etc/glance/glance-api.conf]'
'template[/etc/glance/glance-api.conf]',
], :immediately
end

View File

@ -33,7 +33,7 @@ auth_url = ::URI.decode identity_admin_endpoint.to_s
interfaces = {
public: { url: public_endpoint('image_api') },
internal: { url: internal_endpoint('image_api') },
admin: { url: admin_endpoint('image_api') }
admin: { url: admin_endpoint('image_api') },
}
admin_user = node['openstack']['identity']['admin_user']
@ -55,7 +55,7 @@ connection_params = {
openstack_username: admin_user,
openstack_api_key: admin_pass,
openstack_project_name: admin_project,
openstack_domain_name: admin_domain
openstack_domain_name: admin_domain,
}
# Register Image Service

View File

@ -69,7 +69,7 @@ describe 'openstack-image::api' do
/^bind_port = 9292$/,
/^registry_host = 127.0.0.1$/,
/^registry_port = 9191$/,
/^registry_client_protocol = http$/
/^registry_client_protocol = http$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
@ -79,7 +79,7 @@ describe 'openstack-image::api' do
it do
[
%r{^filesystem_store_datadir = /var/lib/glance/images$},
/^default_store = file$/
/^default_store = file$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('glance_store', line)
@ -88,7 +88,7 @@ describe 'openstack-image::api' do
it do
[
/^flavor = keystone$/
/^flavor = keystone$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('paste_deploy', line)
@ -104,7 +104,7 @@ describe 'openstack-image::api' do
%r{^signing_dir = /var/cache/glance/api$},
%r{^auth_url = http://127.0.0.1:5000/v3$},
/^password = glance-pass$/,
/^user_domain_name = Default$/
/^user_domain_name = Default$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('keystone_authtoken', line)
@ -113,7 +113,7 @@ describe 'openstack-image::api' do
it do
[
%r{^connection = mysql\+pymysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$}
%r{^connection = mysql\+pymysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$},
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('database', line)
@ -139,7 +139,7 @@ describe 'openstack-image::api' do
it do
[
/^registry_port = 9191$/,
/^registry_host = 127.0.0.1$/
/^registry_host = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
@ -166,7 +166,7 @@ describe 'openstack-image::api' do
it do
[
/^registry_port = 9191$/,
/^registry_host = 127.0.0.1$/
/^registry_host = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)

View File

@ -15,7 +15,7 @@ describe 'openstack-image::identity_registration' do
openstack_username: 'admin',
openstack_api_key: 'admin-pass',
openstack_project_name: 'admin',
openstack_domain_name: 'default'
openstack_domain_name: 'default',
}
service_name = 'glance'
service_type = 'image'

View File

@ -19,7 +19,7 @@ describe 'openstack-image::image_upload' do
it 'uploads the cirros image' do
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep cirros').and_return(false)
expect(chef_run).to upload_openstack_image_image('Image setup for cirros').with(
image_url: 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img',
image_url: 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img',
image_name: 'cirros',
image_type: 'qcow',
image_public: true,
@ -39,10 +39,10 @@ describe 'openstack-image::image_upload' do
it 'uploads the tar image' do
node.set['openstack']['image']['upload_images'] = ['imageName']
node.set['openstack']['image']['upload_image']['imageName'] = 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz'
node.set['openstack']['image']['upload_image']['imageName'] = 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-uec.tar.gz'
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-project-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v3 --os-user-domain-name Default --os-project-domain-name Default image-list | grep imageName').and_return(false)
expect(chef_run).to upload_openstack_image_image('Image setup for imageName').with(
image_url: 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz',
image_url: 'http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-uec.tar.gz',
image_name: 'imageName',
image_type: 'unknown',
image_public: true

View File

@ -70,7 +70,7 @@ describe 'openstack-image::registry' do
%r{^transport_url = rabbit://guest:mypass@127.0.0.1:5672$},
%r{^log_file = /var/log/glance/registry.log$},
/^bind_port = 9191$/,
/^bind_host = 127.0.0.1$/
/^bind_host = 127.0.0.1$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
@ -79,7 +79,7 @@ describe 'openstack-image::registry' do
it do
[
/^flavor = keystone$/
/^flavor = keystone$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('paste_deploy', line)
@ -95,7 +95,7 @@ describe 'openstack-image::registry' do
%r{^signing_dir = /var/cache/glance/registry},
%r{^auth_url = http://127.0.0.1:5000/v3},
/^user_domain_name = Default$/,
/^password = glance-pass$/
/^password = glance-pass$/,
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('keystone_authtoken', line)
@ -104,7 +104,7 @@ describe 'openstack-image::registry' do
it do
[
%r{^connection = mysql\+pymysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$}
%r{^connection = mysql\+pymysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$},
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('database', line)

View File

@ -10,12 +10,12 @@ LOG_LEVEL = :fatal
REDHAT_OPTS = {
platform: 'redhat',
version: '7.1',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
}.freeze
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '16.04',
log_level: LOG_LEVEL
log_level: LOG_LEVEL,
}.freeze
# Helper methods