1 require 'puppet/provider/keystone'
3 Puppet::Type.type(:keystone_endpoint).provide(
5 :parent => Puppet::Provider::Keystone
8 desc "Provider to manage keystone endpoints."
10 @credentials = Puppet::Provider::Openstack::CredentialsV2_0.new
12 def initialize(value={})
19 # The region property is just ignored. We should fix this in kilo.
20 region, name = resource[:name].split('/')
22 properties << '--region'
24 if resource[:public_url]
25 properties << '--publicurl'
26 properties << resource[:public_url]
28 if resource[:internal_url]
29 properties << '--internalurl'
30 properties << resource[:internal_url]
32 if resource[:admin_url]
33 properties << '--adminurl'
34 properties << resource[:admin_url]
36 self.class.request('endpoint', 'create', properties)
37 @property_hash[:ensure] = :present
41 self.class.request('endpoint', 'delete', @property_hash[:id])
46 @property_hash[:ensure] == :present
50 @property_hash[:region]
53 def public_url=(value)
54 @property_flush[:public_url] = value
58 @property_hash[:public_url]
61 def internal_url=(value)
62 @property_flush[:internal_url] = value
66 @property_hash[:internal_url]
70 @property_flush[:admin_url] = value
74 @property_hash[:admin_url]
82 list = request('endpoint', 'list', '--long')
83 list.collect do |endpoint|
85 :name => "#{endpoint[:region]}/#{endpoint[:service_name]}",
88 :region => endpoint[:region],
89 :public_url => endpoint[:publicurl],
90 :internal_url => endpoint[:internalurl],
91 :admin_url => endpoint[:adminurl]
96 def self.prefetch(resources)
98 resources.keys.each do |name|
99 if provider = endpoints.find{ |endpoint| endpoint.name == name }
100 resources[name].provider = provider
106 if ! @property_flush.empty?
109 @property_flush.clear