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
This commit is contained in:
Samuel Cassiba 2017-08-20 12:08:42 -04:00
parent 862bfdd7c4
commit 5279aa4fbc
7 changed files with 23 additions and 33 deletions

View File

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

View File

@ -171,7 +171,7 @@ when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
'keystone_packages' => ['openstack-keystone', 'openstack-selinux'], 'keystone_packages' => ['openstack-keystone', 'openstack-selinux'],
'keystone_service' => 'openstack-keystone', 'keystone_service' => 'openstack-keystone',
'keystone_process_name' => 'keystone-all', 'keystone_process_name' => 'keystone-all',
'package_options' => '' 'package_options' => '',
} }
when 'debian' when 'debian'
# platform specific package and service name options # platform specific package and service name options
@ -180,7 +180,7 @@ when 'debian'
'keystone_packages' => ['keystone'], 'keystone_packages' => ['keystone'],
'keystone_service' => 'keystone', 'keystone_service' => 'keystone',
'keystone_process_name' => 'keystone-all', '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 end

View File

@ -47,7 +47,7 @@ connection_params = {
openstack_username: admin_user, openstack_username: admin_user,
openstack_api_key: admin_pass, openstack_api_key: admin_pass,
openstack_project_name: admin_project, openstack_project_name: admin_project,
openstack_domain_name: admin_domain openstack_domain_name: admin_domain,
} }
ruby_block 'wait for identity admin endpoint' do ruby_block 'wait for identity admin endpoint' do

View File

@ -128,16 +128,6 @@ execute 'fernet setup' do
--keystone-user #{keystone_user} --keystone-user #{keystone_user}
--keystone-group #{keystone_group} --keystone-group #{keystone_group}
EOH 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 end
# define the address to bind the keystone apache main service to # 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', '%'), 'compute' => compute_public_endpoint.to_s.gsub('%25', '%'),
'ec2' => ec2_public_endpoint.to_s.gsub('%25', '%'), 'ec2' => ec2_public_endpoint.to_s.gsub('%25', '%'),
'network' => network_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 template '/etc/keystone/default_catalog.templates' do
@ -319,13 +309,13 @@ wsgi_apps = {
'main' => { 'main' => {
server_host: main_bind_address, server_host: main_bind_address,
server_port: main_bind_service.port, server_port: main_bind_service.port,
server_entry: '/usr/bin/keystone-wsgi-public' server_entry: '/usr/bin/keystone-wsgi-public',
}, },
'admin' => { 'admin' => {
server_host: admin_bind_address, server_host: admin_bind_address,
server_port: admin_bind_service.port, 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 # create the keystone apache config using the web_app resource from the apache2

View File

@ -39,7 +39,7 @@ describe 'openstack-identity::openrc' do
/^export OS_PROJECT_DOMAIN_NAME=default$/, /^export OS_PROJECT_DOMAIN_NAME=default$/,
/^export OS_IDENTITY_API_VERSION=3$/, /^export OS_IDENTITY_API_VERSION=3$/,
%r{^export OS_AUTH_URL=http://127.0.0.1:5000/v3$}, %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| ].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)
end end
@ -68,7 +68,7 @@ describe 'openstack-identity::openrc' do
/^export OS_USERNAME=identity_admin$/, /^export OS_USERNAME=identity_admin$/,
/^export OS_PROJECT_NAME=admin-project-name-override$/, /^export OS_PROJECT_NAME=admin-project-name-override$/,
/^export OS_PASSWORD=identity_admin_pass$/, /^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| ].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)
end end

View File

@ -16,7 +16,7 @@ describe 'openstack-identity::registration' do
openstack_username: 'admin', openstack_username: 'admin',
openstack_api_key: 'admin', openstack_api_key: 'admin',
openstack_project_name: 'admin', openstack_project_name: 'admin',
openstack_domain_name: 'default' openstack_domain_name: 'default',
} }
service_user = 'admin' service_user = 'admin'
role_name = 'admin' role_name = 'admin'
@ -68,7 +68,7 @@ describe 'openstack-identity::registration' do
openstack_username: 'identity_admin', openstack_username: 'identity_admin',
openstack_api_key: 'identity_admin_pass', openstack_api_key: 'identity_admin_pass',
openstack_project_name: 'admin_project', openstack_project_name: 'admin_project',
openstack_domain_name: 'identity_domain' openstack_domain_name: 'identity_domain',
} }
before do before do
node.set['openstack']['endpoints']['admin']['identity']['uri'] = node.set['openstack']['endpoints']['admin']['identity']['uri'] =

View File

@ -8,12 +8,12 @@ LOG_LEVEL = :fatal
REDHAT_OPTS = { REDHAT_OPTS = {
platform: 'redhat', platform: 'redhat',
version: '7.1', version: '7.1',
log_level: LOG_LEVEL log_level: LOG_LEVEL,
}.freeze }.freeze
UBUNTU_OPTS = { UBUNTU_OPTS = {
platform: 'ubuntu', platform: 'ubuntu',
version: '16.04', version: '16.04',
log_level: LOG_LEVEL log_level: LOG_LEVEL,
}.freeze }.freeze
# Helper methods # Helper methods
@ -56,9 +56,9 @@ shared_context 'identity_stubs' do
'openstack' => { 'openstack' => {
'identity' => { 'identity' => {
'admin_tenant_name' => 'admin', 'admin_tenant_name' => 'admin',
'admin_user' => 'admin' 'admin_user' => 'admin',
} },
} },
}] }]
) )
allow_any_instance_of(Chef::Recipe).to receive(:get_password) allow_any_instance_of(Chef::Recipe).to receive(:get_password)