From 6cb5b076f37a1c3afe66488c8b495e2d433df833 Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 22 Jun 2015 19:11:45 -0400 Subject: [PATCH] auth_file: allow to change the path Default path is /root/openrc. Some use-cases might want to change the path. Change-Id: I2e37e3e968f6885916c5632fc60368fca04cd434 --- manifests/auth_file.pp | 7 ++++++- spec/classes/openstack_extras_auth_file_spec.rb | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/manifests/auth_file.pp b/manifests/auth_file.pp index 193df36..ab21a2f 100644 --- a/manifests/auth_file.pp +++ b/manifests/auth_file.pp @@ -64,6 +64,10 @@ # (optional) The method to use for authentication # Defaults to 'keystone'. # +# [*path*] +# (optional) File path +# Defaults to '/root/openrc'. +# class openstack_extras::auth_file( $password = undef, $auth_url = 'http://127.0.0.1:5000/v2.0/', @@ -79,11 +83,12 @@ class openstack_extras::auth_file( $nova_endpoint_type = 'publicURL', $neutron_endpoint_type = 'publicURL', $auth_strategy = 'keystone', + $path = '/root/openrc', ) { if ! $password { fail('You must specify a password for openstack_extras::auth_file') } - file { '/root/openrc': + file { $path: owner => 'root', group => 'root', mode => '0700', diff --git a/spec/classes/openstack_extras_auth_file_spec.rb b/spec/classes/openstack_extras_auth_file_spec.rb index 6052b07..1e695b8 100644 --- a/spec/classes/openstack_extras_auth_file_spec.rb +++ b/spec/classes/openstack_extras_auth_file_spec.rb @@ -83,4 +83,16 @@ describe 'openstack_extras::auth_file' do ]) end end + + describe "when the file is in /tmp" do + + let :params do + { + :password => 'secret', + :path => '/tmp/openrc' + } + end + + it { should contain_file('/tmp/openrc')} + end end