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) }
5 require 'puppet/provider/keystone/util'
7 Puppet::Type.newtype(:keystone_user_role) do
10 This is currently used to model the creation of
13 User roles are an assignment of a role to a user on
14 a certain tenant. The combination of all of these
20 newparam(:name, :namevar => true) do
23 newproperty(:roles, :array_matching => :all) do
25 return false unless is.is_a? Array
26 # order of roles does not matter
27 is.sort == self.should.sort
31 autorequire(:keystone_user) do
32 self[:name].rpartition('@').first
35 autorequire(:keystone_tenant) do
36 proj, dom = Util.split_domain(self[:name].rpartition('@').last)
38 if proj # i.e. not ::domain
39 rv = self[:name].rpartition('@').last
44 autorequire(:keystone_role) do
48 autorequire(:keystone_domain) do
50 userdom = Util.split_domain(self[:name].rpartition('@').first)[1]
54 projectdom = Util.split_domain(self[:name].rpartition('@').last)[1]
61 # we should not do anything until the keystone service is started
62 autorequire(:service) do