]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/keystone/lib/puppet/type/keystone_tenant.rb
Add the posibility to tell openstack to use --os_cacert for keystone_tenant
[dsa-puppet.git] / 3rdparty / modules / keystone / lib / puppet / type / keystone_tenant.rb
1 # LP#1408531
2 File.expand_path('../..', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) }
3 require 'puppet/util/openstack'
4 Puppet::Type.newtype(:keystone_tenant) do
5
6   desc 'This type can be used to manage keystone tenants.'
7
8   ensurable
9
10   newparam(:name, :namevar => true) do
11     desc 'The name of the tenant.'
12     newvalues(/\w+/)
13   end
14
15   newparam(:os_cacert) do
16     desc 'Parse os_cacert.'
17   end
18
19   newproperty(:enabled) do
20     desc 'Whether the tenant should be enabled. Defaults to true.'
21     newvalues(/(t|T)rue/, /(f|F)alse/, true, false )
22     defaultto(true)
23     munge do |value|
24       value.to_s.downcase.to_sym
25     end
26   end
27
28   newproperty(:description) do
29     desc 'A description of the tenant.'
30     defaultto('')
31   end
32
33   newproperty(:id) do
34     desc 'Read-only property of the tenant.'
35     validate do |v|
36       raise(Puppet::Error, 'This is a read only property')
37     end
38   end
39
40   # This ensures the service is started and therefore the keystone
41   # config is configured IF we need them for authentication.
42   # If there is no keystone config, authentication credentials
43   # need to come from another source.
44   autorequire(:service) do
45     ['keystone']
46   end
47
48   auth_param_doc=<<EOT
49 If no other credentials are present, the provider will search in
50 /etc/keystone/keystone.conf for an admin token and auth url.
51 EOT
52   Puppet::Util::Openstack.add_openstack_type_methods(self, auth_param_doc)
53 end