2 File.expand_path('../..', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) }
3 File.expand_path('../../../../openstacklib/lib', File.dirname(__FILE__)).tap { |dir| $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir) }
4 require 'puppet/provider/keystone/util'
6 Puppet::Type.newtype(:keystone_tenant) do
8 desc 'This type can be used to manage keystone tenants.'
12 newparam(:name, :namevar => true) do
13 desc 'The name of the tenant.'
17 newproperty(:enabled) do
18 desc 'Whether the tenant should be enabled. Defaults to true.'
19 newvalues(/(t|T)rue/, /(f|F)alse/, true, false )
22 value.to_s.downcase.to_sym
26 newproperty(:description) do
27 desc 'A description of the tenant.'
32 desc 'Read-only property of the tenant.'
34 raise(Puppet::Error, 'This is a read only property')
38 newproperty(:domain) do
39 desc 'Domain for tenant.'
42 raise(Puppet::Error, "The domain cannot be changed from #{self.should} to #{is}") unless self.should == is
47 autorequire(:keystone_domain) do
48 # use the domain parameter if given, or the one from name if any
49 self[:domain] || Util.split_domain(self[:name])[1]
52 # This ensures the service is started and therefore the keystone
53 # config is configured IF we need them for authentication.
54 # If there is no keystone config, authentication credentials
55 # need to come from another source.
56 autorequire(:service) do