Files
Takashi Kajinami 26dbd52717 Libvirt: quote config parameters in resource types
This change implements the quote parameter in libvirtd_config and
virtlogd_config, so that we can quote the value by that simple
parameter instead of implementing a logic in each manifests.

Also, with this change libvirtd_config and virtlogd_config supports
$::os_service_default, so that we can define absence of parameters more
easily.

Depends-on: https://review.opendev.org/792735
Change-Id: I3030ca34088019be932a9cc33344f7fb473a9aea
2021-06-22 16:13:52 +05:30

38 lines
615 B
Ruby

Puppet::Type.type(:libvirtd_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def exists?
if resource[:value] == ensure_absent_val
resource[:ensure] = :absent
elsif resource[:quote]
unless resource[:value].start_with?('"')
resource[:value] = '"' + resource[:value] + '"'
end
end
super
end
def section
''
end
def setting
resource[:name]
end
def separator
'='
end
def ensure_absent_val
resource[:ensure_absent_val]
end
def self.file_path
'/etc/libvirt/libvirtd.conf'
end
end