puppet-swift/lib/puppet/provider/swift_proxy_config/ini_setting.rb
Mathieu Gagné e41a552afe Add ini_setting based custom types for configs
Previous configuration file management method used templates.
This method had limited flexibility and was cumbersome
to use and maintain between upstream versions.

This change introduces new custom types based on ini_setting:
  * swift_account_config: /etc/swift/account-server.conf
  * swift_bench_config: /etc/swift/swift-bench.conf
  * swift_config: /etc/swift/swift.conf
  * swift_container_config: /etc/swift/container-server.conf
  * swift_dispersion_config: /etc/swift/dispersion.conf
  * swift_object_config: /etc/swift/object-server.conf
  * swift_proxy_config: /etc/swift/proxy-server.conf

The use of ini_setting offers multiple advantages:
  * Ability to individually manage configuration settings without
    the need to modify templates. This allows the user to manage or
    override settings that aren't handled by the module.
  * Use upstream default values if none is provided.
  * Remove the need to maintain and synchronize templates
    to match upstream versions. Such maintenance could become
    problematic and complicated if multiple upstream versions
    are supported but have different base configuration files.

Implements: blueprint puppet-swift-ini-settings
Change-Id: Iba7be64581b81b8ab4f33cf7096df37e64ccc4b4
2013-07-25 10:19:30 -04:00

28 lines
467 B
Ruby

Puppet::Type.type(:swift_proxy_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 self.file_path
'/etc/swift/proxy-server.conf'
end
# added for backwards compatibility with older versions of inifile
def file_path
self.class.file_path
end
end