]> git.donarmstrong.com Git - dsa-puppet.git/blob - 3rdparty/modules/keystone/lib/puppet/type/keystone_service.rb
add stackforge/keystone to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / keystone / lib / puppet / type / keystone_service.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_service) do
5
6   desc 'This type can be used to manage keystone services.'
7
8   ensurable
9
10   newparam(:name, :namevar => true) do
11     desc 'The name of the service.'
12     newvalues(/\S+/)
13   end
14
15   newproperty(:id) do
16     validate do |v|
17       raise(Puppet::Error, 'This is a read only property')
18     end
19   end
20
21   newproperty(:type) do
22     desc 'The type of service'
23     validate do |value|
24       fail('The service type is required.') unless value
25     end
26   end
27
28   newproperty(:description) do
29     desc 'A description of the service.'
30     defaultto('')
31   end
32
33   # This ensures the service is started and therefore the keystone
34   # config is configured IF we need them for authentication.
35   # If there is no keystone config, authentication credentials
36   # need to come from another source.
37   autorequire(:service) do
38     ['keystone']
39   end
40
41   auth_param_doc=<<EOT
42 If no other credentials are present, the provider will search in
43 /etc/keystone/keystone.conf for an admin token and auth url.
44 EOT
45   Puppet::Util::Openstack.add_openstack_type_methods(self, auth_param_doc)
46 end