From 995fe07550f34423d2b5f406f53ec8df182ef5a8 Mon Sep 17 00:00:00 2001 From: Samuel Cassiba Date: Fri, 1 Sep 2017 10:12:29 -0400 Subject: [PATCH] Corrected keystone bootstrapping command - the original invocation of keystone-manage bootstrap was in the wrong recipe, so it needed to be moved to server-apache for resource ordering. restored the original flags used - regen .rubocop_todo.yml to pass rubocop Closes-Bug: #1714510 Change-Id: I9d3916e7f306d4c0463ec93cad40d2e78bd7eed8 --- .rubocop_todo.yml | 4 ++-- recipes/server-apache.rb | 17 ++++++++++++++--- spec/server-apache_spec.rb | 15 ++++++++++++++- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 2bccd47..e6799d3 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2017-08-17 14:16:09 +0200 using RuboCop version 0.47.1. +# on 2017-09-01 10:04:34 -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 @@ -9,7 +9,7 @@ # Offense count: 20 # Configuration parameters: CountComments, ExcludedMethods. Metrics/BlockLength: - Max: 393 + Max: 395 # Offense count: 4 # Configuration parameters: EnforcedStyle, SupportedStyles. diff --git a/recipes/server-apache.rb b/recipes/server-apache.rb index 49a4615..1f13b5d 100644 --- a/recipes/server-apache.rb +++ b/recipes/server-apache.rb @@ -53,7 +53,10 @@ identity_internal_endpoint = internal_endpoint 'identity' identity_public_endpoint = public_endpoint 'identity' # define the credentials to use for the initial admin user +admin_project = node['openstack']['identity']['admin_project'] +admin_user = node['openstack']['identity']['admin_user'] admin_pass = get_password 'user', node['openstack']['identity']['admin_user'] +admin_role = node['openstack']['identity']['admin_role'] region = node['openstack']['identity']['region'] keystone_user = node['openstack']['identity']['user'] keystone_group = node['openstack']['identity']['group'] @@ -270,9 +273,17 @@ execute 'keystone-manage db_sync' do end # bootstrap keystone after keystone.conf is generated -execute 'keystone bootstrap' do - user 'root' - command "keystone-manage bootstrap --bootstrap-password \"#{admin_pass}\" --bootstrap-region-id \"#{region}\" --bootstrap-admin-url #{identity_admin_endpoint} --bootstrap-public-url #{identity_public_endpoint} --bootstrap-internal-url #{identity_internal_endpoint}" +execute 'bootstrap_keystone' do + command "keystone-manage bootstrap \\ + --bootstrap-password #{admin_pass} \\ + --bootstrap-username #{admin_user} \\ + --bootstrap-project-name #{admin_project} \\ + --bootstrap-role-name #{admin_role} \\ + --bootstrap-service-name keystone \\ + --bootstrap-region-id #{region} \\ + --bootstrap-admin-url #{identity_admin_endpoint} \\ + --bootstrap-public-url #{identity_public_endpoint} \\ + --bootstrap-internal-url #{identity_internal_endpoint}" end #### Start of Apache specific work diff --git a/spec/server-apache_spec.rb b/spec/server-apache_spec.rb index 0c80824..b4c6fe0 100644 --- a/spec/server-apache_spec.rb +++ b/spec/server-apache_spec.rb @@ -14,7 +14,11 @@ describe 'openstack-identity::server-apache' do include Helpers include_context 'identity_stubs' + service_name = 'keystone' + service_user = 'admin' region = 'RegionOne' + project_name = 'admin' + role_name = 'admin' password = 'admin' admin_url = 'http://127.0.0.1:35357/v3' public_url = 'http://127.0.0.1:5000/v3' @@ -47,7 +51,16 @@ describe 'openstack-identity::server-apache' do end it 'bootstrap with keystone-manage' do - expect(chef_run).to run_execute('keystone bootstrap').with(command: "keystone-manage bootstrap --bootstrap-password \"#{password}\" --bootstrap-region-id \"#{region}\" --bootstrap-admin-url #{admin_url} --bootstrap-public-url #{public_url} --bootstrap-internal-url #{internal_url}") + expect(chef_run).to run_execute('bootstrap_keystone').with(command: "keystone-manage bootstrap \\ + --bootstrap-password #{password} \\ + --bootstrap-username #{service_user} \\ + --bootstrap-project-name #{project_name} \\ + --bootstrap-role-name #{role_name} \\ + --bootstrap-service-name #{service_name} \\ + --bootstrap-region-id #{region} \\ + --bootstrap-admin-url #{admin_url} \\ + --bootstrap-public-url #{public_url} \\ + --bootstrap-internal-url #{internal_url}") end describe '/etc/keystone' do