puppet-neutron/lib/puppet/provider/neutron_l3_agent_config/ini_setting.rb
Javier Pena 3a456e1de1 Make the neutron_l3_agent provider compatible with Puppet 4
We need to change the way it requires puppet/provider/neutron, or
it will fail with:

"Error: Could not autoload
puppet/provider/neutron_l3_agent_config/ini_setting: cannot load
such file -- puppet/provider/neutron"

Change-Id: Ic6f494b4c614d604f5691c95b2f67705a91bf682
2016-10-07 16:34:40 +02:00

31 lines
807 B
Ruby

require File.join(File.dirname(__FILE__), '..','..','..',
'puppet/provider/neutron')
Puppet::Type.type(:neutron_l3_agent_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def self.file_path
'/etc/neutron/l3_agent.ini'
end
# added for backwards compatibility with older versions of inifile
def file_path
self.class.file_path
end
def to_uuid(name)
neutron = Puppet::Provider::Neutron.new
neutron.auth_neutron('router-show', "#{name}",
'--format=value', '--column=id').chop
end
def from_uuid(uuid)
neutron = Puppet::Provider::Neutron.new
neutron.auth_neutron('router-show', "#{uuid}",
'--format=value', '--column=name').chop
end
end