Add Providers & Types

This commit is contained in:
Émilien Macchi 2013-05-30 21:50:33 +02:00
parent 7549efce43
commit 7b14b0f797
8 changed files with 164 additions and 0 deletions

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:heat_api_cfn_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
'/etc/heat/heat-api-cfn.conf'
end
end

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:heat_api_cloudwatch_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
'/etc/heat/heat-api-cloudwatch.conf'
end
end

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:heat_api_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
'/etc/heat/heat-api.conf'
end
end

View File

@ -0,0 +1,22 @@
Puppet::Type.type(:heat_engine_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
'/etc/heat/heat-engine.conf'
end
end

View File

@ -0,0 +1,19 @@
Puppet::Type.newtype(:heat_api_cfn_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from heat_api_cfn.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
end
end

View File

@ -0,0 +1,19 @@
Puppet::Type.newtype(:heat_api_cloudwatch_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from heat-api-cloudwatch.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
end
end

View File

@ -0,0 +1,19 @@
Puppet::Type.newtype(:heat_api_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from heat-api.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
end
end

View File

@ -0,0 +1,19 @@
Puppet::Type.newtype(:heat_engine_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from heat-engine.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
end
end