Merge "ability to set location for openrc file"
This commit is contained in:
commit
5b69467a69
|
@ -6,3 +6,4 @@
|
|||
*.swp
|
||||
Berksfile.lock
|
||||
Vagrantfile
|
||||
Gemfile.lock
|
||||
|
|
|
@ -471,3 +471,11 @@ default['openstack']['identity_service_chef_role'] = 'os-identity'
|
|||
|
||||
# Array of bare options for openrc (e.g. 'option=value')
|
||||
default['openstack']['misc_openrc'] = nil
|
||||
|
||||
# openrc location and owner
|
||||
default['openstack']['openrc']['path'] = '/root'
|
||||
default['openstack']['openrc']['file'] = 'openrc'
|
||||
default['openstack']['openrc']['user'] = 'root'
|
||||
default['openstack']['openrc']['group'] = 'root'
|
||||
default['openstack']['openrc']['file_mode'] = '0600'
|
||||
default['openstack']['openrc']['path_mode'] = '0700'
|
||||
|
|
|
@ -42,13 +42,18 @@ end
|
|||
ksadmin_pass = get_password 'user', ksadmin_user
|
||||
identity_endpoint = endpoint 'identity-api'
|
||||
|
||||
template '/root/openrc' do
|
||||
directory node['openstack']['openrc']['path'] do
|
||||
owner node['openstack']['openrc']['user']
|
||||
group node['openstack']['openrc']['group']
|
||||
mode node['openstack']['openrc']['path_mode']
|
||||
recursive true
|
||||
end
|
||||
|
||||
template "#{node['openstack']['openrc']['path']}/#{node['openstack']['openrc']['file']}" do
|
||||
source 'openrc.erb'
|
||||
# TODO: (MRV) Consider making the name, location, contents and owner/group
|
||||
# of this more flexible with attributes.
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00600
|
||||
owner node['openstack']['openrc']['user']
|
||||
group node['openstack']['openrc']['group']
|
||||
mode node['openstack']['openrc']['file_mode']
|
||||
variables(
|
||||
user: ksadmin_user,
|
||||
tenant: ksadmin_tenant_name,
|
||||
|
|
|
@ -16,10 +16,16 @@ describe 'openstack-common::openrc' do
|
|||
let(:file) { chef_run.template('/root/openrc') }
|
||||
|
||||
it 'creates the /root/openrc file' do
|
||||
expect(chef_run).to create_directory('/root').with(
|
||||
owner: 'root',
|
||||
group: 'root',
|
||||
mode: '0700',
|
||||
recursive: true
|
||||
)
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
user: 'root',
|
||||
group: 'root',
|
||||
mode: 0600
|
||||
mode: '0600'
|
||||
)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue