From 5279aa4fbc6e2885e86954105237c94d71890f20 Mon Sep 17 00:00:00 2001 From: Samuel Cassiba Date: Sun, 20 Aug 2017 12:08:42 -0400 Subject: [PATCH] Initial identity Pike updates - Switched default linter to cookstyle - Renamed rake tasks to better conform with Chef conventions - Removed deprecated credential_setup Change-Id: I518ed83f7e19c590e7846160889faf46db274b3a --- Rakefile | 14 +++++++------- attributes/default.rb | 4 ++-- recipes/registration.rb | 2 +- recipes/server-apache.rb | 18 ++++-------------- spec/openrc_spec.rb | 4 ++-- spec/registration_spec.rb | 4 ++-- spec/spec_helper.rb | 10 +++++----- 7 files changed, 23 insertions(+), 33 deletions(-) diff --git a/Rakefile b/Rakefile index 676e7d4..c9edb13 100644 --- a/Rakefile +++ b/Rakefile @@ -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" diff --git a/attributes/default.rb b/attributes/default.rb index 386b49c..5db96f6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -171,7 +171,7 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this 'keystone_packages' => ['openstack-keystone', 'openstack-selinux'], 'keystone_service' => 'openstack-keystone', 'keystone_process_name' => 'keystone-all', - 'package_options' => '' + 'package_options' => '', } when 'debian' # platform specific package and service name options @@ -180,7 +180,7 @@ when 'debian' 'keystone_packages' => ['keystone'], 'keystone_service' => 'keystone', 'keystone_process_name' => 'keystone-all', - 'package_options' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'" + 'package_options' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'", } end diff --git a/recipes/registration.rb b/recipes/registration.rb index 9a53fd1..e553534 100644 --- a/recipes/registration.rb +++ b/recipes/registration.rb @@ -47,7 +47,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, } ruby_block 'wait for identity admin endpoint' do diff --git a/recipes/server-apache.rb b/recipes/server-apache.rb index be866e4..036ef62 100644 --- a/recipes/server-apache.rb +++ b/recipes/server-apache.rb @@ -128,16 +128,6 @@ execute 'fernet setup' do --keystone-user #{keystone_user} --keystone-group #{keystone_group} EOH - notifies :run, 'execute[credential setup]', :immediately -end - -execute 'credential setup' do - user 'root' - command <<-EOH.gsub(/\s+/, ' ').strip! - keystone-manage credential_setup - --keystone-user #{keystone_user} - --keystone-group #{keystone_group} - EOH end # define the address to bind the keystone apache main service to @@ -249,7 +239,7 @@ if node['openstack']['identity']['catalog']['backend'] == 'templated' 'compute' => compute_public_endpoint.to_s.gsub('%25', '%'), 'ec2' => ec2_public_endpoint.to_s.gsub('%25', '%'), 'network' => network_public_endpoint.to_s.gsub('%25', '%'), - 'volume' => volume_public_endpoint.to_s.gsub('%25', '%') + 'volume' => volume_public_endpoint.to_s.gsub('%25', '%'), } template '/etc/keystone/default_catalog.templates' do @@ -319,13 +309,13 @@ wsgi_apps = { 'main' => { server_host: main_bind_address, server_port: main_bind_service.port, - server_entry: '/usr/bin/keystone-wsgi-public' + server_entry: '/usr/bin/keystone-wsgi-public', }, 'admin' => { server_host: admin_bind_address, server_port: admin_bind_service.port, - server_entry: '/usr/bin/keystone-wsgi-admin' - } + server_entry: '/usr/bin/keystone-wsgi-admin', + }, } # create the keystone apache config using the web_app resource from the apache2 diff --git a/spec/openrc_spec.rb b/spec/openrc_spec.rb index 343cc04..5e7c481 100644 --- a/spec/openrc_spec.rb +++ b/spec/openrc_spec.rb @@ -39,7 +39,7 @@ describe 'openstack-identity::openrc' do /^export OS_PROJECT_DOMAIN_NAME=default$/, /^export OS_IDENTITY_API_VERSION=3$/, %r{^export OS_AUTH_URL=http://127.0.0.1:5000/v3$}, - /^export OS_REGION_NAME=RegionOne$/ + /^export OS_REGION_NAME=RegionOne$/, ].each do |line| expect(chef_run).to render_file(file.name).with_content(line) end @@ -68,7 +68,7 @@ describe 'openstack-identity::openrc' do /^export OS_USERNAME=identity_admin$/, /^export OS_PROJECT_NAME=admin-project-name-override$/, /^export OS_PASSWORD=identity_admin_pass$/, - %r{^export OS_AUTH_URL=https://public.identity:1234/v3$} + %r{^export OS_AUTH_URL=https://public.identity:1234/v3$}, ].each do |line| expect(chef_run).to render_file(file.name).with_content(line) end diff --git a/spec/registration_spec.rb b/spec/registration_spec.rb index b867e1a..4bc5aca 100644 --- a/spec/registration_spec.rb +++ b/spec/registration_spec.rb @@ -16,7 +16,7 @@ describe 'openstack-identity::registration' do openstack_username: 'admin', openstack_api_key: 'admin', openstack_project_name: 'admin', - openstack_domain_name: 'default' + openstack_domain_name: 'default', } service_user = 'admin' role_name = 'admin' @@ -68,7 +68,7 @@ describe 'openstack-identity::registration' do openstack_username: 'identity_admin', openstack_api_key: 'identity_admin_pass', openstack_project_name: 'admin_project', - openstack_domain_name: 'identity_domain' + openstack_domain_name: 'identity_domain', } before do node.set['openstack']['endpoints']['admin']['identity']['uri'] = diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 93f9885..2f27e4a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -8,12 +8,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 @@ -56,9 +56,9 @@ shared_context 'identity_stubs' do 'openstack' => { 'identity' => { 'admin_tenant_name' => 'admin', - 'admin_user' => 'admin' - } - } + 'admin_user' => 'admin', + }, + }, }] ) allow_any_instance_of(Chef::Recipe).to receive(:get_password)