Add a proxy inifile provider

Create a proxy inifile provider that will sit between the openstack
configuration providers (ie. keystone_config) and the actual ini_setting
provider.

Adding such a component will give us more flexibility on the ini_setting
provider. With that in place we could :

 * Test new feature with the provider - merge them upstream when validated
 * Bypass upstream limit if our queries are not valid for upstream.

By inheriting the provider we don't fork and hence should remain
compatible with the next releases of puppetlabs-inifile

Change-Id: I061371d8cf2faf928019161e635e1b4252a6b433
changes/88/202488/6
Yanis Guenane 7 years ago
parent c0dcc266ae
commit f754ef3bcf
  1. 1
      .fixtures.yml
  2. 30
      lib/puppet/provider/openstack_config/ini_setting.rb
  3. 3
      lib/puppet/type/openstack_config.rb
  4. 12
      lib/puppet_x/openstack/util/ini_file.rb
  5. 1
      metadata.json

@ -4,6 +4,7 @@ fixtures:
concat:
repo: 'git://github.com/puppetlabs/puppetlabs-concat.git'
ref: '1.2.1'
inifile: git://github.com/puppetlabs/puppetlabs-inifile.git
mysql: git://github.com/puppetlabs/puppetlabs-mysql.git
postgresql: git://github.com/puppetlabs/puppetlabs-postgresql.git
stdlib: git://github.com/puppetlabs/puppetlabs-stdlib.git

@ -0,0 +1,30 @@
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),"..","..",".."))
require 'puppet_x/openstack/util/ini_file'
Puppet::Type.type(:openstack_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def file_path
self.class.file_path
end
private
def ini_file
@ini_file ||= PuppetX::Openstack::Util::IniFile.new(file_path, separator, section_prefix, section_suffix)
end
end

@ -0,0 +1,3 @@
Puppet::Type.newtype(:openstack_config) do
end

@ -0,0 +1,12 @@
require File.expand_path('../../../../../../inifile/lib/puppet/util/ini_file', __FILE__)
module PuppetX
module Openstack
module Util
class IniFile < Puppet::Util::IniFile
end
end
end
end

@ -32,6 +32,7 @@
"description": "Puppet module library to expose common functionality between OpenStack modules.",
"dependencies": [
{ "name": "puppetlabs/apache", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "puppetlabs/mysql", "version_requirement": ">=3.0.0 <4.0.0" },
{ "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" },
{ "name": "puppetlabs/rabbitmq", "version_requirement": ">=2.0.2 <6.0.0" },

Loading…
Cancel
Save